Skip to content

Instantly share code, notes, and snippets.

@dj-amadeous
Created October 30, 2018 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dj-amadeous/165487ccc0bcd3f60ede6f4f5ea34e93 to your computer and use it in GitHub Desktop.
Save dj-amadeous/165487ccc0bcd3f60ede6f4f5ea34e93 to your computer and use it in GitHub Desktop.
example of using fgets to get integer input to avoid scanf
int getSize(){
int numEl;
char term[3];
printf("Enter size of Array:");
fgets(term, 6, stdin);
numEl = strtol(term, NULL, 10);
return numEl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment