0% found this document useful (0 votes)
5 views2 pages

C Programming Notes DriveUpload

The document provides an overview of C programming concepts including primitive data types, structures, self-referential structures, pointers, and matrix multiplication. It defines various data types such as int, float, double, char, and void, and illustrates the use of structures with an example. Additionally, it explains pointers and includes a sample C program for matrix multiplication using nested loops.

Uploaded by

nareshbalaji2006
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

C Programming Notes DriveUpload

The document provides an overview of C programming concepts including primitive data types, structures, self-referential structures, pointers, and matrix multiplication. It defines various data types such as int, float, double, char, and void, and illustrates the use of structures with an example. Additionally, it explains pointers and includes a sample C program for matrix multiplication using nested loops.

Uploaded by

nareshbalaji2006
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

C Programming Notes

1. Primitive Data Types

Primitive data types are the basic building blocks in C:

- int: Integer values (e.g., int x = 10;)

- float: Single-precision decimal (e.g., float f = 3.14;)

- double: Double-precision decimal (e.g., double d = 3.14159;)

- char: Single character (e.g., char c = 'A';)

- void: No value (used for functions with no return value)

2. Structure

Structure is a user-defined data type that groups different types:

Example:

struct Student {

int id;

char name[20];

float marks;

};

struct Student s1 = {1, "Naresh", 85.5};

3. Self-Referential Structure

Structure that has a pointer to itself:

struct Node {

int data;

struct Node *next;

};
C Programming Notes

Used in Linked Lists, Trees, etc.

4. Pointers

Pointers store memory addresses:

int a = 5;

int *p = &a;

printf("%d", *p); // prints 5

printf("%p", p); // prints address of a

5. Matrix Multiplication (C Program)

Enter dimensions and values for two matrices.

Check if column1 == row2. Multiply using triple loop:

for(i=0; i<r1; i++)

for(j=0; j<c2; j++) {

mul[i][j] = 0;

for(k=0; k<c1; k++)

mul[i][j] += a[i][k] * b[k][j];

You might also like