C Strings Structures Notes
C Strings Structures Notes
1. Introduction to Strings
A string is a one-dimensional array of characters terminated by a null character '\0'. Strings are used
C automatically inserts the null character when initializing strings with double quotes, e.g., char
name[] = "HELLO";
Answer:
```
#include <stdio.h>
#include <string.h>
int main() {
return 0;
```
Answer:
```
#include <stdio.h>
int main() {
while(*ptr != '\0') {
ptr++;
return 0;
```
4. Structures in C
Structures allow grouping of variables of different types under a single name. Useful in database
management and handling complex data. Structure elements are accessed using the dot (.)
operator.
Answer:
```
#include <stdio.h>
struct Book {
char title[50];
char author[50];
float price;
};
int main() {
return 0;
```
5. Conclusion
Understanding strings and structures in C is crucial for handling complex data and performing
various operations efficiently. Make sure to practice writing and manipulating strings and structures