New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modification #15
base: master
Are you sure you want to change the base?
modification #15
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
the introduced changes are probably not necessary as they are handled in later assignments. However, I hope you find my comments on your changes helpful for yourself. If you are going to do further pull request in this or any other project, it would be very helpful if you would split them per section (in this case per assignment), squash your changes and add more meaningful commit messages. Finally it would be nice if you avoid spaces in filenames, as escaping them while compiling via command line sucks.
Thanks and best regards
Andreas
scanf("%f",&j); | ||
char ch; | ||
printf("enter the character \n"); //input a character | ||
scanf("%s",&ch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a potential security risk, as you are reading a string into a single char. You should consider using scanf_s() with %c instead:
scanf_s("%c", &c, 1);
EDIT: scanf_s
is not part of C99 and is an optional extension of C11. So using it may reduce portability of your code, however most compilers implement it.
//date of creation: 05/02/20 | ||
int main() | ||
{ | ||
int i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing identation.
int main() | ||
{ | ||
int i; | ||
printf("enter a number \n"); //input an integer number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for newline here:
printf("enter a number: ");
printf("%d is an integer \n",i); | ||
printf("%f is a float \n",j); | ||
printf("%s is a character \n",&ch); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line not necessary and return statement missing.
printf("enter the last name \n"); //input last name | ||
scanf("%s",&str2); | ||
printf("hello %s %s",&str1,&str2); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty line not necessary and return statement missing.
{ | ||
char str1[10],str2[10]; | ||
printf("enter the first name \n"); //input the first name | ||
scanf("%s",&str1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you know the length of the string , you should consider using scanf_s() instead:
// Do not forget to account for the trailing null byte
scanf_s("%s", &str1, 9);
EDIT: scanf_s is not part of C99 and is an optional extension of C11. So using it may reduce portability of your code, however most compilers implement it.
scanf("%s",&str1); | ||
printf("enter the last name \n"); //input last name | ||
scanf("%s",&str2); | ||
printf("hello %s %s",&str1,&str2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline in printf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok sir i really appreciate your efforts to have a look at my report and thanks for the honest reviews
No description provided.