Category Archives: A ll Codes

Struct Deep Example

code:

struct some other beautiful example:
code:

 

File Handling: Read Content From a Binary File

code:

 

File Handling: Formatted Data Reading and Writing Example

code:

 

File Handling: Fprintf Write Content to a File

code:

 

File Handling: Take formated input from textfile using fscanf() function

code:

output:

frmt.txt

 

Read Content From a File using Fgets

code:

 

Read Content from Text file using C

code:

 

File Handling in C

code:

 

Arguments from Command Line Console

code:

 

Problem 85: Product

Create a structure named Product with following two fields-

1. name (string)
2. price (double)

Then create a function named printProductInfo() which takes a parameter of Product type and print the information of that Product. Finally, in main function create a variable of structure Product named myProduct and call the printProductInfo() function passing myProduct as the parameter.
code:

 

Struct Problem 1: 101cproblems

Problem 81: Struct GPA

Create a simple structure named Student that holds the following variables-
i. id (integer)
ii. cgpa (float)
iii. name (string)
Now create an instance of that structure named s1 and scan the values from the user. Finally print the id, cgpa and name which user entered.

code:

Source:http://101cproblems.com/problem-81/

Another approach:

 

Typedef Enum Union Project

code:

 

Typedef Enum

code:

 

Another Good Example of Struct using Function and Pointer

code:

 

Using function with Struct user defined type also pointer

code:

why we used *sp in one place and sp in another place ?there s a reason behind this
*sp means address is passing where after the local input takeup it will go but if not use  dereferencing then it will not go outside. So to write we need with address.

and in sp it is read only. so to print sp is enough to show.

vid: