- #1
Simon Clement
- 18
- 3
Hello
So please I'm quite new at C programming. I've been using scanf a lot in my codes but I also encounter some problems with it and I have been told to try and avoid using scanf.
Now I'm learning getc function, but don't quite get it fully. I've surfed the net and all I see are very basic examples.
Please why does the code below compiles well but doesn't execute fully? Also is there a way to take in integers without using scanf i.e without using something like
So please I'm quite new at C programming. I've been using scanf a lot in my codes but I also encounter some problems with it and I have been told to try and avoid using scanf.
Now I'm learning getc function, but don't quite get it fully. I've surfed the net and all I see are very basic examples.
Please why does the code below compiles well but doesn't execute fully? Also is there a way to take in integers without using scanf i.e without using something like
Code:
scanf("%d",&x);
Code:
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
int main()
{
char *name;
printf("Enter full names: ");
gets(name);
printf("Thank you Mr. %s",name[0]);
return 0;
}
Last edited: