Write a c program to print your class students name using looping statement?
Answers
Answered by
0
Answer:
for(int i = 0; i < names; i++) {
printf("name: %s\n", names[i]);
#include <stdio.h>
int main() {
char names[2][50] = {
"Ram",
"Shyam"
}
for(int i = 0; i < names; i++) {
printf("name: %s\n", names[i]);
}
Explanation:
Char names creates a list of names. [2] is how many strings there is and [50] is the max length of a string in characters or bytes.
for loop prints all the names in the loop. Thanks.
Array of strings : https://overiq.com/c-programming-101/array-of-strings-in-c/
For loop: https://www.programiz.com/c-programming/c-for-loop
Similar questions
Science,
9 days ago
History,
9 days ago
Math,
19 days ago
Math,
9 months ago
Computer Science,
9 months ago