C language learned by suffering
C language learned by suffering
Exercise 3
fundamental knowledge
Q1-1
What function is used to display a string on the screen in C language?
Q 1-2
To use the above function, you must pass instructions to the compiler.
Answer the pseudo instruction to do so and the filename of the instruction to be passed.
Answer the pseudo instruction to do so and the filename of the instruction to be passed.
Q1-3
To break a line when displaying a string in the above function, write a symbol.
What is the symbol in general called?
What is the symbol in general called?
program read-only
Q2-1
#include <stdio.h>
int main(void)
{
printf("The pen is mightier than the sword");
return 0;
printf("Time is money\n");
}
program writing
Q3-1
Create a program that displays the following on the screen.
Note that the number of spaces does not matter as long as the head of the second character is aligned.
Intel : Pentium4
AMD : Athlon64
Note that the number of spaces does not matter as long as the head of the second character is aligned.
Intel : Pentium4
AMD : Athlon64
Basic Knowledge (sample answers)
Solution 1-1
printf function
*There are many others, such as puts, but the printf function is the basic one.
Solution 1-2
Pseudo instruction #include
File name stdio.h
File name stdio.h
*#include <stdio.h> is also correct.
Solution 1-3
escape sequence
Program reading (example solution)
Solution 2-1
The pen is mightier
than the sword
than the sword
*The last statement is not displayed because the function ends with return.
Program writing (example of solution)
Q3-1
#include <stdio.h>
int main(void)
{
printf("Intel\t: Pentium4\n");
printf("AMD\t: Athlon64\n");
return 0;
}
It is acceptable to align with spaces instead of using ↵t, but it is easier to use ↵t.
Note that the line break \n at the end of a sentence is easily forgotten, even by experienced users.
About this Site
The C language (bitter C), which is learned by suffering, is
This is the definitive C language introductory site.
It systematically explains the basic functions of the C language and
It is as complete as or more complete than any book on the market.