Q. I have an error free C code, am writing for you. This code searches for the string “C+Trivia” in Google. Surprised, how it can be?
#include "stdio.h"
#include "stdlib.h"
int main()
{http://www.google.com;
char* str;
printf("C + Trivia",str);
puts(str);
return 0;
}
Read more about this program here.
Did you run the code on your system? Yes???
roflolzzz
:):):):)!!!
understood the program or i need to explain anything?
Had you thought of Google search to be so easy in C??
Thanks Linux For You!


Can you define the working of this program ?
@hardy:
it is not doing anything like Search in Google!
the http line is valid, since http: becomes a label and
//www.google.com is a valid C comment.
Every other thing in a program is well understood.
getting the error while compiling your piece of code …. help me maverick
[root@localhost test]# gcc code.c
code.c: In function ‘main’:
code.c:8: error: expected expression before ‘char’
code.c:9: error: ‘str’ undeclared (first use in this function)
code.c:9: error: (Each undeclared identifier is reported only once
code.c:9: error: for each function it appears in.)
Did you try fixing it?
errors say they don’t find any declaration of “str” once the label is set.
write char* str; before the label to get rid of it.
The intent was not to get it work correctly but just to know the trivial thing in the code.