Why is #include <stdio.h> is underlined in red? - c

I have this basic code in C. A program to say 'Hello World'. And the first line That say #include <stdio.h> is underlined in red as though an error is occurred.
#include<stdio.h>
main()
{
printf("hello, world\n")
}
I'm using vs code to run the program, is it a bug in vs code? or maybe a problem in the installation of C?
please help.
I don't understand where the problem originates so no actions have been pursued.

Add space between #include and <stdio.h>
Also, specify the return type of your main function.
Also at the end of printf("hello, world\n"), there should be semi colon
#include <stdio.h>
void main(){
printf("hello, world\n");
}
it is void since it is not returning anything.

Related

#include errors detected in vs code for c lang

I don't know what to do
please can any one help me
I'm trying to use c in vs code for the first time
#include <stdio.h>
int main (void)
{
printf("Hello, World!");
}
The problem

wchar_t strings not working C

I'm trying to create a program that needs to get string input from the user, since it's has to work with portuguese words i'm using wchar_t,the problem is,
C seems to have a will, because when i need it to work it doens't but then out of the blue it works in some simple test.
the following code worked 5 minutes ago and now it doesn't:
#include <stdio.h>
#include <wchar.h>
#include <locale.h>
/
int main(){
setlocale(LC_ALL,"Portuguese");
wchar_t meu[3];
fgetws(meu,3,stdin);
fputws(meu,stdout);
return 0;
}

Type mismatch in Redeclaration

I have been able to remove almost all errors except these 5 errors in this C program (too long to paste so providing link).
http://codepad.org/AfqrDojN
The errors I receive are as follows:
I am using the following libraries:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>
What could be the issue?
you are redefining the function remove that is already declared in
#include <stdio.h>
changing the name of your function to (for example) void myremove() will probably solve your problem.

if defined(__AIX) not working on AIX 6.1?

I have the following on AIX 6.1:
#include <stdio.h>
#include <stdlib.h>
int main(){
#if defined(__AIX)
printf("hello world");
#endif
return 0;
}
I have followed the instructions from http://predef.sourceforge.net/preos.html#sec2 but am scratching my head as to why it does not work or print out "hello world" when I run it?
if I do a "uname" on the box I get "AIX"...and "uname -v" returns "6"...
Any ideas what I can put into the code?
Thanks for the help
Lynton
should be 1 underscore not 2 underscores before "AIX"....solved now ;-)

Problem in referencing the outportb() function In C

I have a code in which am trying to use outportb(), but while compiling it on MinGw i am getting below error.
C:\Users\A_TOMAR\AppData\Local\Temp\ccYPvctv.o:dsp.c:(.text+0x68): undefined reference to `outportb'
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
int main(void)
{
outportb(0x378,0xFF);
return 0;
}
I would like to know which header file is having this particular function?
Windows doesn't provide access to a hardware. You should use Win32 API calls.
This function is DOS specific and unavailable in Windows
Googling shows that your solution is inpout32.dll (example with weird font color)
#include <pc.h>
void outportb(unsigned short _port, unsigned char _data);

Resources