how do you write a basic function
Is this the correct way to write a function in C programming such as s("%s" hello);?
void print_hello()
{
char hello[] = "Hello";
printf("%s\n", hello);
}
Reply:#include %26lt;stdio.h%26gt;
void s(char *str)
{
printf("%s", str);
}
int main()
{
char *a="hello world";
s(a);
return 0;
}
///this should compile and run fine....
Reply:you declared function s wrongly it should take arguments like this.
s(char * a)
{
int x=1, b=2;
printf("%d", x + "%d", b)
}
magnolia
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment