Group A
Group B
11.
12.
Data types in C programming include int, float, double, char, and more. They are used to define the type of data that a variable can store and determine the operations that can be performed on that data.
In C programming, there are several data types, including:
- int: Used for integer values.
- float: Used for floating-point numbers.
- double: Used for double-precision floating-point numbers.
- char: Used for single characters.
- void: Represents absence of type.
- _Bool: Represents boolean values (0 for false, any non-zero value for true).
- Enumeration (enum): Used to define custom data types with a finite set of values.
- Array: Used to store a collection of elements of the same data type.
- Pointer: Used to store memory addresses.
Each data type has its specific use case and range of values it can hold.
13.
- Escape sequences: They are special characters in strings preceded by a backslash (
\
). They are used to represent characters that are difficult or impossible to represent directly in code. For example,\n
represents a newline character. - Delimiter: A delimiter is a character used to specify the boundary between separate, independent regions in plain text or other data streams. For example, in CSV files, commas are used as delimiters to separate fields.
Example:
14.
Pointers in C can be used in arithmetic operations such as addition, subtraction, etc. This is often used to navigate through arrays or allocate memory dynamically.
15.
16.
Group C
17.
18.
20
Group D
21
C programming language provides a variety of string manipulation functions in the standard library <string.h>
. Here are some commonly used string library functions along with examples for each:
- strlen(): Returns the length of the string.
strcpy(): Copies one string to another.
strcat(): Concatenates two strings.
strcmp(): Compares two strings.
strchr(): Finds the first occurrence of a character in a string.
strstr(): Finds the first occurrence of a substring in a string.
22.
Passing arguments by value and passing arguments by address are two different ways to pass parameters to functions in C, each with its advantages and disadvantages.
Passing Arguments by Value:
When passing arguments by value, the function receives a copy of the actual parameter’s value. Any modifications made to the parameter within the function do not affect the original variable in the calling function.
Example:
Passing Arguments by Address:
When passing arguments by address (also known as passing by reference), the function receives the address (memory location) of the actual parameter. This allows the function to directly modify the value of the variable in the calling function.
Example: