How to iterate over a string in C?
C Programming Language String functions in C (Article) String functions in C (Program)
457Program:
#include #include int main() { int i; char arrayName[] = "Rumman Ansari"; for(i = 0; i < strlen(arrayName); i++) { printf("%c", arrayName[i]); } }
Output:
Rumman Ansari
Explanation:
You can use this code also
arrayLength = strlen(arrayName); for(i = 0; i < arrayLength; i++)
#include #include int main() { int i, arrayLength; char arrayName[] = "Rumman Ansari"; arrayLength = strlen(arrayName); for(i = 0; i < arrayLength; i++) { printf("%c", arrayName[i]); } }
for(i = 0; arrayName[i] != 0; i++)
#include #include int main() { int i, arrayLength; char arrayName[] = "Rumman Ansari"; for(i = 0; arrayName[i] != 0; i++) { printf("%c", arrayName[i]); } }
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.