This document provides 50 interview questions on C programming language organized into 5 chapters: Variables & Control Flow, Operators, Constants & Structures, Functions, Pointers, and Programs. It aims to help both freshers and experienced programmers quickly brush up on basic C concepts commonly asked during job interviews at top companies. Each question is accompanied by a detailed answer along with code examples where applicable. Feedback is welcomed to be sent to the publisher.
C programming is a general-purpose language developed in the 1970s to write operating systems like UNIX. It is one of the most widely used languages, particularly for systems programming. Some key facts: C was created to develop UNIX and is still widely used for operating systems, compilers, databases and other modern programs. It has various data types like integers, floats, characters, arrays and structures. Variables are defined with a data type and can be initialized. C code is written in files with a .c extension and preprocessed before compilation.
Structures-Declaring and Initializing, Nested structure, Array of Structure, Passing Structures to functions, Unions, typedef, enum, Bit fields.
Pointers: Declarations, Pointer arithmetic, Pointers and functions, call by value, Call by reference, Pointers and Arrays, Arrays of Pointers, Pointers and Structures. Meaning of static and dynamic memory allocation, Memory allocation functions.
Files: File modes, File functions, and File operations, Text and Binary files, Command Line arguments Preprocessor directives. Macros: Definition, types of Macros, Creating and implementing user defined header files
This document provides an overview of the C programming language. It discusses the origins and development of C from the B programming language. Some key features and benefits of C discussed include its low-level capabilities as a second-generation language, structured programming approach, use of functions and libraries, and support for pointers, memory allocation, recursion, and bit manipulation. The document also covers C's fundamental and derived data types, defining variables and strings, and the structure of C functions including single-level functions.
Functions: Function Definition, prototyping, types of functions, passing arguments to functions, Nested Functions, Recursive functions.
Strings: Declaring and Initializing strings, Operations on strings, Arrays of strings, passing strings to functions. Storage Classes: Automatic, External, Static and Register Variables.
Structures-Declaring and Initializing, Nested structure, Array of Structure, Passing Structures to functions, Unions, typedef, enum, Bit fields.
Pointers: Declarations, Pointer arithmetic, Pointers and functions, call by value, Call by reference, Pointers and Arrays, Arrays of Pointers, Pointers and Structures. Meaning of static and dynamic memory allocation, Memory allocation functions.
Files: File modes, File functions, and File operations, Text and Binary files, Command Line arguments Preprocessor directives. Macros: Definition, types of Macros, Creating and implementing user defined header files
This document discusses object-oriented programming in C++. It covers several topics related to OOP in C++ including classes, constructors, destructors, inheritance, polymorphism, and templates. The document consists of lecture slides that define key concepts and provide examples to illustrate how various OOP features work in C++.
The document provides an introduction to the C programming language, including its history, features, character sets, tokens, data types, operators, and the basic structure of a C program. It discusses key concepts such as variables, constants, comments, functions, input/output, and how to compile and execute a C program.
This document provides 50 interview questions on C programming language organized into 5 chapters: Variables & Control Flow, Operators, Constants & Structures, Functions, Pointers, and Programs. It aims to help both freshers and experienced programmers quickly brush up on basic C concepts commonly asked during job interviews at top companies. Each question is accompanied by a detailed answer along with code examples where applicable. Feedback is welcomed to be sent to the publisher.
C programming is a general-purpose language developed in the 1970s to write operating systems like UNIX. It is one of the most widely used languages, particularly for systems programming. Some key facts: C was created to develop UNIX and is still widely used for operating systems, compilers, databases and other modern programs. It has various data types like integers, floats, characters, arrays and structures. Variables are defined with a data type and can be initialized. C code is written in files with a .c extension and preprocessed before compilation.
Structures-Declaring and Initializing, Nested structure, Array of Structure, Passing Structures to functions, Unions, typedef, enum, Bit fields.
Pointers: Declarations, Pointer arithmetic, Pointers and functions, call by value, Call by reference, Pointers and Arrays, Arrays of Pointers, Pointers and Structures. Meaning of static and dynamic memory allocation, Memory allocation functions.
Files: File modes, File functions, and File operations, Text and Binary files, Command Line arguments Preprocessor directives. Macros: Definition, types of Macros, Creating and implementing user defined header files
This document provides an overview of the C programming language. It discusses the origins and development of C from the B programming language. Some key features and benefits of C discussed include its low-level capabilities as a second-generation language, structured programming approach, use of functions and libraries, and support for pointers, memory allocation, recursion, and bit manipulation. The document also covers C's fundamental and derived data types, defining variables and strings, and the structure of C functions including single-level functions.
Functions: Function Definition, prototyping, types of functions, passing arguments to functions, Nested Functions, Recursive functions.
Strings: Declaring and Initializing strings, Operations on strings, Arrays of strings, passing strings to functions. Storage Classes: Automatic, External, Static and Register Variables.
Structures-Declaring and Initializing, Nested structure, Array of Structure, Passing Structures to functions, Unions, typedef, enum, Bit fields.
Pointers: Declarations, Pointer arithmetic, Pointers and functions, call by value, Call by reference, Pointers and Arrays, Arrays of Pointers, Pointers and Structures. Meaning of static and dynamic memory allocation, Memory allocation functions.
Files: File modes, File functions, and File operations, Text and Binary files, Command Line arguments Preprocessor directives. Macros: Definition, types of Macros, Creating and implementing user defined header files
This document discusses object-oriented programming in C++. It covers several topics related to OOP in C++ including classes, constructors, destructors, inheritance, polymorphism, and templates. The document consists of lecture slides that define key concepts and provide examples to illustrate how various OOP features work in C++.
The document provides an introduction to the C programming language, including its history, features, character sets, tokens, data types, operators, and the basic structure of a C program. It discusses key concepts such as variables, constants, comments, functions, input/output, and how to compile and execute a C program.
The document discusses the role of CLR (Common Language Runtime) in .NET framework. It explains that CLR converts programs to native code, handles exceptions, provides type safety, memory management, security, improved performance and is language and platform independent. It also discusses garbage collection and language features supported by CLR. The main components of CLR are CTS (Common Type System), JIT (Just-In-Time) compiler and CLS (Common Language Specification). CTS defines value and reference types while JIT compiles CIL to machine code. CLS provides language interoperability.
This document provides an overview of the C programming language. It discusses that C was developed in the 1970s as a system programming language and is still widely used today. The document outlines key features of C including data types, operators, expressions, input/output functions, and the basic structure of a C program with function definitions and variable declarations. It also describes basic program elements in C like variables, constants, and data types in detail.
C++ variables can hold different data types like numbers and characters. Variables must be declared with a name and type before use and can be assigned values. Keywords like int and double are used to declare variable types for whole numbers and decimals. Variables are output using cout and input using cin. User input and output allows the program to display prompts and receive user-entered values.
This document provides an overview of C++ programming concepts including:
1. C++ programs consist of functions, with every program containing a main() function. Functions contain declarations, statements, comments, and can call libraries.
2. Variables must be declared with a type and can be used to store values. C++ supports integer, floating point, character, and other variable types.
3. C++ allows selection and decision making using if/else statements, switch statements, logical operators, and loops like while and for. Operators allow comparisons and boolean evaluations.
Do you want to learn basic information about the c Language?
Yes!
That’s great.
This pdf is the right choice for you.
Here, I will provide you all the basic information about C language.
You can visit our blog to enjoy our original post.
The document discusses using structures in C programming. Key points covered include:
1. Structures allow grouping of heterogeneous data types and are defined using the "struct" keyword.
2. Structure variables can be passed to functions by value or reference, and pointers can be used to access structure members.
3. Arrays of structures can be declared and elements accessed using indexes.
4. Structures can be used to organize data for file handling, with functions like fwrite() and fread() used to write and read structure data to/from files.
C++ programming language basic to advance levelsajjad ali khan
C/C++ is a procedural programming language developed in the 1970s. C++ builds on C and adds object-oriented programming capabilities. Some key differences between C and C++ include C++ supporting classes, function overloading, and operator overloading. C++ is commonly used to create operating systems, compilers, databases, games, and other application software. The document then discusses C++ history, creators, uses, data types, variables, operators, control flow statements like if/else and loops, arrays, and multi-dimensional arrays. It provides examples of C++ code and basics of the C++ programming language.
This PPT File helps IT freshers with the Basic Interview Questions, which will boost there confidence before going to the Interview. For more details and Interview Questions please log in www.rekruitin.com and click on Job Seeker tools. Also register on the and get employed.
By ReKruiTIn.com
This document outlines the basics of C++ programming, including:
- The history and evolution of C++ and other programming languages.
- How a C++ source code is compiled into an executable program by the compiler in multiple steps like preprocessing, compiling, linking etc.
- The structure of a basic C++ program and key elements like main function, headers, comments.
- How to use input/output streams, variables, arithmetic operations, and conditional statements like if-else in a C++ program.
Complete C++ programming Language CourseVivek chan
This document provides an overview of topics covered in a C++ programming course, including:
- Introduction to C++ language fundamentals like data types, variables, operators, control structures, functions, and classes
- Memory concepts, arithmetic, decision making, and algorithms
- Structured and object-oriented programming principles
- The basics of the C++ environment like compilers, linkers, and input/output streams
- Common library functions and concepts like headers, prototypes, and enumerations
The document serves as an introductory reference for anyone learning C++ or wanting to understand the basic building blocks of the language.
C++ Basics introduction to typecasting Webinar Slides 1Ali Raza Jilani
The document provides information about algorithms and programming fundamentals in C++. It discusses what algorithms are, how to write them, and examples of algorithms to determine if a number is even or odd or if a student passed an exam. It also covers flowcharts, programming languages, data types, variables, operators, and comments in C++.
This document contains an agenda for a presentation on embedded systems. It includes an introduction to embedded systems, why embedded C is used, sample interview questions, and a Q&A section. Some key interview questions cover real-time systems, software testing, pointers, macros, variable scopes, and debugging with tracing. Example code is provided to demonstrate pointers, a macro to set the most significant bit, and a function to find the maximum of two values.
This document provides an introduction to the C programming language. It discusses that C was developed in 1972 and explains some key concepts in C including data types, variables, constants, and functions. It also demonstrates a simple C program to print text and explains how C code is compiled and executed.
The document introduces the basic structure of a C program, including comments, header files, the main function, variables and data types, keywords, and constants. It explains that a C program contains comments, includes header files like stdio.h for input/output functions, has a main function that is the program entry point, uses variables of specific data types, and can define numeric and symbolic constants.
Programming is hard. Programming correct C and C++ is particularly hard. Indeed, both in C and certainly in C++, it is uncommon to see a screenful containing only well defined and conforming code.Why do professional programmers write code like this? Because most programmers do not have a deep understanding of the language they are using.While they sometimes know that certain things are undefined or unspecified, they often do not know why it is so. In these slides we will study small code snippets in C and C++, and use them to discuss the fundamental building blocks, limitations and underlying design philosophies of these wonderful but dangerous programming languages.
This content has a CC license. Feel free to use it for whatever you want. You may download the original PDF file from: http://www.pvv.org/~oma/DeepC_slides_oct2012.pdf
This document provides an introduction to the C programming language. It discusses fundamental C elements like data types, variables, constants, operators, and input/output functions. It explains how a basic C program is structured and compiled. Examples are provided to demonstrate simple C statements, arithmetic expressions, and how to write and run a first program that prints text. The key topics covered include basic syntax, program structure, data types, identifiers, operators, and input/output functions like printf() and scanf().
C programming & data structure [character strings & string functions]MomenMostafa
The document provides information about C programming language and data structures. It includes references to books and websites on the topics. The document outlines topics that will be covered, including arrays and pointers, strings and string functions, structures, algorithms, stacks, queues and trees. It then gives details on a lesson about string functions, including examples of gets(), puts(), fgets() and other standard library string functions.
1. Pointers are variables that store memory addresses and can be used to manipulate other variables and arrays. Pointer variables must be declared with a data type and can be initialized using the address-of operator.
2. Arithmetic operations can be performed on pointers to change what they point to, with the amount of change depending on the data type. Pointers can iterate through arrays and strings.
3. Two-dimensional arrays can be viewed as arrays of pointers, allowing strings to be manipulated. Pointers simplify string handling functions like calculating length and checking for palindromes.
This document contains 10 questions and answers about various C language concepts:
1. C was developed between 1969-1973 at Bell Labs by Dennis Ritchie, aimed for use with UNIX OS. It is widely used for application and system software development.
2. A static variable in C is declared inside a function but its value is retained between function calls.
3. A normal variable stores a value that can change, while a pointer defines the address of another variable rather than storing a value itself.
C is a general-purpose programming language developed in the early 1970s. It was designed to be compiled using a minimal compiler for portability. C is still widely used today due to its speed, flexibility and ability to access low-level hardware which makes it suitable for system programming tasks like operating systems, language compilers, databases etc. The document provides an overview of the history and evolution of C, why it is still useful, basic C programming concepts like variables, data types, expressions and operators.
The document provides an overview of the C programming language, including its history, characteristics, environment, structure, data types, variables, decision making, looping, libraries, and uses. It describes how C was developed at Bell Labs in the early 1970s and later standardized. The summary highlights C's small fixed set of keywords, static typing, use of headers and functions, and popularity for systems programming and performance-critical applications due to its efficiency and ability to access hardware.
C is a general-purpose programming language widely used to develop operating systems and compilers. It was developed in the early 1970s at Bell Labs by Dennis Ritchie. Some key reasons for C's popularity include its efficiency, ability to access low-level hardware, and ability to be compiled on a variety of computers. C source code files use a .c extension and must be compiled into an executable binary file before running. Common uses of C include operating systems, language compilers, databases, and network drivers.
The document discusses the role of CLR (Common Language Runtime) in .NET framework. It explains that CLR converts programs to native code, handles exceptions, provides type safety, memory management, security, improved performance and is language and platform independent. It also discusses garbage collection and language features supported by CLR. The main components of CLR are CTS (Common Type System), JIT (Just-In-Time) compiler and CLS (Common Language Specification). CTS defines value and reference types while JIT compiles CIL to machine code. CLS provides language interoperability.
This document provides an overview of the C programming language. It discusses that C was developed in the 1970s as a system programming language and is still widely used today. The document outlines key features of C including data types, operators, expressions, input/output functions, and the basic structure of a C program with function definitions and variable declarations. It also describes basic program elements in C like variables, constants, and data types in detail.
C++ variables can hold different data types like numbers and characters. Variables must be declared with a name and type before use and can be assigned values. Keywords like int and double are used to declare variable types for whole numbers and decimals. Variables are output using cout and input using cin. User input and output allows the program to display prompts and receive user-entered values.
This document provides an overview of C++ programming concepts including:
1. C++ programs consist of functions, with every program containing a main() function. Functions contain declarations, statements, comments, and can call libraries.
2. Variables must be declared with a type and can be used to store values. C++ supports integer, floating point, character, and other variable types.
3. C++ allows selection and decision making using if/else statements, switch statements, logical operators, and loops like while and for. Operators allow comparisons and boolean evaluations.
Do you want to learn basic information about the c Language?
Yes!
That’s great.
This pdf is the right choice for you.
Here, I will provide you all the basic information about C language.
You can visit our blog to enjoy our original post.
The document discusses using structures in C programming. Key points covered include:
1. Structures allow grouping of heterogeneous data types and are defined using the "struct" keyword.
2. Structure variables can be passed to functions by value or reference, and pointers can be used to access structure members.
3. Arrays of structures can be declared and elements accessed using indexes.
4. Structures can be used to organize data for file handling, with functions like fwrite() and fread() used to write and read structure data to/from files.
C++ programming language basic to advance levelsajjad ali khan
C/C++ is a procedural programming language developed in the 1970s. C++ builds on C and adds object-oriented programming capabilities. Some key differences between C and C++ include C++ supporting classes, function overloading, and operator overloading. C++ is commonly used to create operating systems, compilers, databases, games, and other application software. The document then discusses C++ history, creators, uses, data types, variables, operators, control flow statements like if/else and loops, arrays, and multi-dimensional arrays. It provides examples of C++ code and basics of the C++ programming language.
This PPT File helps IT freshers with the Basic Interview Questions, which will boost there confidence before going to the Interview. For more details and Interview Questions please log in www.rekruitin.com and click on Job Seeker tools. Also register on the and get employed.
By ReKruiTIn.com
This document outlines the basics of C++ programming, including:
- The history and evolution of C++ and other programming languages.
- How a C++ source code is compiled into an executable program by the compiler in multiple steps like preprocessing, compiling, linking etc.
- The structure of a basic C++ program and key elements like main function, headers, comments.
- How to use input/output streams, variables, arithmetic operations, and conditional statements like if-else in a C++ program.
Complete C++ programming Language CourseVivek chan
This document provides an overview of topics covered in a C++ programming course, including:
- Introduction to C++ language fundamentals like data types, variables, operators, control structures, functions, and classes
- Memory concepts, arithmetic, decision making, and algorithms
- Structured and object-oriented programming principles
- The basics of the C++ environment like compilers, linkers, and input/output streams
- Common library functions and concepts like headers, prototypes, and enumerations
The document serves as an introductory reference for anyone learning C++ or wanting to understand the basic building blocks of the language.
C++ Basics introduction to typecasting Webinar Slides 1Ali Raza Jilani
The document provides information about algorithms and programming fundamentals in C++. It discusses what algorithms are, how to write them, and examples of algorithms to determine if a number is even or odd or if a student passed an exam. It also covers flowcharts, programming languages, data types, variables, operators, and comments in C++.
This document contains an agenda for a presentation on embedded systems. It includes an introduction to embedded systems, why embedded C is used, sample interview questions, and a Q&A section. Some key interview questions cover real-time systems, software testing, pointers, macros, variable scopes, and debugging with tracing. Example code is provided to demonstrate pointers, a macro to set the most significant bit, and a function to find the maximum of two values.
This document provides an introduction to the C programming language. It discusses that C was developed in 1972 and explains some key concepts in C including data types, variables, constants, and functions. It also demonstrates a simple C program to print text and explains how C code is compiled and executed.
The document introduces the basic structure of a C program, including comments, header files, the main function, variables and data types, keywords, and constants. It explains that a C program contains comments, includes header files like stdio.h for input/output functions, has a main function that is the program entry point, uses variables of specific data types, and can define numeric and symbolic constants.
Programming is hard. Programming correct C and C++ is particularly hard. Indeed, both in C and certainly in C++, it is uncommon to see a screenful containing only well defined and conforming code.Why do professional programmers write code like this? Because most programmers do not have a deep understanding of the language they are using.While they sometimes know that certain things are undefined or unspecified, they often do not know why it is so. In these slides we will study small code snippets in C and C++, and use them to discuss the fundamental building blocks, limitations and underlying design philosophies of these wonderful but dangerous programming languages.
This content has a CC license. Feel free to use it for whatever you want. You may download the original PDF file from: http://www.pvv.org/~oma/DeepC_slides_oct2012.pdf
This document provides an introduction to the C programming language. It discusses fundamental C elements like data types, variables, constants, operators, and input/output functions. It explains how a basic C program is structured and compiled. Examples are provided to demonstrate simple C statements, arithmetic expressions, and how to write and run a first program that prints text. The key topics covered include basic syntax, program structure, data types, identifiers, operators, and input/output functions like printf() and scanf().
C programming & data structure [character strings & string functions]MomenMostafa
The document provides information about C programming language and data structures. It includes references to books and websites on the topics. The document outlines topics that will be covered, including arrays and pointers, strings and string functions, structures, algorithms, stacks, queues and trees. It then gives details on a lesson about string functions, including examples of gets(), puts(), fgets() and other standard library string functions.
1. Pointers are variables that store memory addresses and can be used to manipulate other variables and arrays. Pointer variables must be declared with a data type and can be initialized using the address-of operator.
2. Arithmetic operations can be performed on pointers to change what they point to, with the amount of change depending on the data type. Pointers can iterate through arrays and strings.
3. Two-dimensional arrays can be viewed as arrays of pointers, allowing strings to be manipulated. Pointers simplify string handling functions like calculating length and checking for palindromes.
This document contains 10 questions and answers about various C language concepts:
1. C was developed between 1969-1973 at Bell Labs by Dennis Ritchie, aimed for use with UNIX OS. It is widely used for application and system software development.
2. A static variable in C is declared inside a function but its value is retained between function calls.
3. A normal variable stores a value that can change, while a pointer defines the address of another variable rather than storing a value itself.
C is a general-purpose programming language developed in the early 1970s. It was designed to be compiled using a minimal compiler for portability. C is still widely used today due to its speed, flexibility and ability to access low-level hardware which makes it suitable for system programming tasks like operating systems, language compilers, databases etc. The document provides an overview of the history and evolution of C, why it is still useful, basic C programming concepts like variables, data types, expressions and operators.
The document provides an overview of the C programming language, including its history, characteristics, environment, structure, data types, variables, decision making, looping, libraries, and uses. It describes how C was developed at Bell Labs in the early 1970s and later standardized. The summary highlights C's small fixed set of keywords, static typing, use of headers and functions, and popularity for systems programming and performance-critical applications due to its efficiency and ability to access hardware.
C is a general-purpose programming language widely used to develop operating systems and compilers. It was developed in the early 1970s at Bell Labs by Dennis Ritchie. Some key reasons for C's popularity include its efficiency, ability to access low-level hardware, and ability to be compiled on a variety of computers. C source code files use a .c extension and must be compiled into an executable binary file before running. Common uses of C include operating systems, language compilers, databases, and network drivers.
The C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
This document discusses the C programming language. Some key points:
- C was developed in the early 1970s and influenced by many other languages. It is a middle-level language that provides high-level and low-level capabilities.
- C is widely used to develop operating systems, device drivers, databases and other core systems software. It remains popular due to its portability, efficiency and ability to interface with hardware.
- The document outlines C's basic syntax including data types, variables, constants, functions and control structures. It provides examples of common functions like printf, scanf and input/output statements.
- Overall the document serves as an introduction to the C language, its history, capabilities
Here is the class Book with the requested attributes and member functions:
#include <iostream>
using namespace std;
class Book {
private:
string title;
string author;
string publisher;
float price;
public:
Book() {
title = "No title";
author = "No author";
publisher = "No publisher";
price = 0.0;
}
void display_data() {
cout << "Title: " << title << endl;
cout << "Author: " << author << endl;
cout << "Publisher: " << publisher << endl;
cout << "Price: " << price << endl;
}
The document provides an introduction to algorithms and key concepts related to algorithms such as definition, features, examples, flowcharts, pseudocode. It also discusses different types of programming languages from first to fifth generation. Key points of structured programming approach and introduction to C programming language are explained including data types, variables, constants, input/output functions, operators, type conversion etc.
We are one of the best embedded systems training institute for advance courses. We are the pioneer of the embedded system training in Pune & Pcmc with the expertise of over 16 years. we are working in the field training & development of embedded systems & currently we are also working on live projects as per the requirements of clients. though we provide many different courses & training in embedded all aim at giving good practical knowledge to students as well help them in their career.
C is a widely used general-purpose programming language that can be used to develop complex software like operating systems and databases. It supports basic data types like integers, characters, and floating-point values. Constants are declared using the const keyword and cannot change value during program execution. C includes various operators like arithmetic, relational, logical, and bitwise operators to perform operations. Conditional statements and loops allow for control flow and repeated execution of code. Header files contain function declarations and macro definitions that can be included using the #include directive. Structures group related data types under a single name. Functions are blocks of code that perform tasks. Strings are arrays of characters terminated by a null character.
This document provides an introduction to embedded C programming. It defines embedded C as an extension of the C programming language used to develop microcontroller-based applications. The key differences between embedded C and standard C are that embedded C is hardware dependent, compiler dependent, and used for limited resource microcontrollers. The document outlines the basic structure of embedded C programs and lists some common data types and keywords. It also discusses variables, arrays, control structures, functions and macros that are often used in embedded C.
This material is developed in such beautiful manner to the beginners of C language can understand it accurately.
Every concept In material is explained in well disciplined.
Even it will be helpful to the professors for presenting lecture in class room
C is a general-purpose programming language developed in the early 1970s. It was originally created for and used to write the UNIX operating system. C became widely popular due to its efficiency and ability to be compiled on a variety of computers. It is commonly used to write operating systems, compilers, and other lower-level systems programs. C programs are written in text files with a .c extension and compiled into machine-readable code using a C compiler. C supports basic data types like integers, floats, characters, and arrays, as well as user-defined functions, variables, statements, and expressions.
The document provides an introduction to the C programming language. It discusses the structure of a C program including documentation, preprocessor directives, header files, and function definitions. It also describes various math and trigonometric functions available in the standard library like sqrt, pow, sin, cos, and log. The rest of the document outlines the steps to compile and execute a C program and defines key concepts like variables, constants, and data types in C.
C is a widely used general-purpose programming language that can be used to develop complex software like operating systems and databases. It has four basic data types - integer, character, floating-point, and double floating-point. Constants are declared using the const keyword and cannot change value during program execution. Operators perform actions on operands like arithmetic, relational, logical, and assignment operations. Conditional statements and loops allow control flow and repeated execution of code. Header files contain function declarations and macro definitions included using the #include directive. Structures group related variables under a single name. Functions perform specific tasks. Strings are arrays of characters terminated by a null character. C is a mid-level language providing both low-level and high
- All variables in a C program must be declared before they can be used, specifying a name, value, and type.
- The document discusses basic C programming concepts like variables, data types, comments, functions, and arithmetic expressions.
- It provides examples of C code snippets and explains concepts like preprocessing, compiling, linking, and executing a C program.
C programming language tutorial for beginers.pdfComedyTechnology
This document provides an introduction and overview of the basics of C programming language. It discusses the following key topics in 3 or less sentences each:
- Introduction to programming and computer languages.
- Introduction to C programming, its history, uses, and why it is widely used.
- Program structure in C, including main functions, printf statements, comments, and return values.
- Basic syntax rules in C including semicolons, comments, identifiers, and whitespace.
- Common data types in C like char, int, float, and double and their purposes.
- How variables are named, defined through data type declaration, and initialized in C code.
- Common operators in
The document provides an overview of the C standard library. It includes a table listing common C standard library header files and briefly describing their purpose, such as <stdio.h> for input/output functions and <stdlib.h> for memory allocation and process control. The C standard library contains functions for tasks like string manipulation, mathematics, random numbers, memory management and more. It provides a standard library that is common across C implementations.
C is a general-purpose programming language developed in the 1970s. It was created by Dennis Ritchie at Bell Labs to be used for the Unix operating system. Some key features of C include it being a mid-level language, supporting structured programming, having a rich standard library, and allowing for pointers and recursion. A simple "Hello World" program in C prints a message using printf and waits for input with getch. C supports various data types, operators, control structures like if/else and loops, functions, arrays, and pointers.
The document provides an introduction to the C programming language, covering its history, uses, basic concepts, and key functions. It discusses how C was created at Bell Labs to develop the UNIX operating system, its widespread adoption, and importance. The document outlines common C data types, control flow statements like conditionals and loops, functions and their structure, and input/output functions like printf, scanf, gets and puts. It provides examples of basic C programs and how functions, conditionals, and I/O are implemented.
This document provides an overview of C programming and data structures. It begins with an introduction to C language concepts like data types, variables, constants, I/O functions, operators, and control statements. It then discusses the history and evolution of C from earlier languages like ALGOL and BCPL. The document outlines characteristics of C and its applications. It also covers topics like keywords, identifiers, data type sizes, variable naming rules, and comment syntax. Library functions for input/output like scanf and printf are explained. The different types of constants in C like integer, real, character, and string constants are defined along with their syntax rules.
The document provides an overview of the C programming language, including its history, basic structure, data types, operators, input/output, decision making, looping, functions, arrays, pointers, strings, structures, file handling, and linked data structures. Some key topics covered include the C compilation process, basic C program structure, common data types like int and char, arithmetic, relational, and logical operators, if/else and switch statements, while, do-while and for loops, defining functions, and passing arguments to functions.
Similar to Let's us c language (sabeel Bugti) (20)
Chinese is considered one of the most difficult languages in the world to learn due to its tonal nature, unique writing system with thousands of characters, and differences from languages like English in grammar and pronunciation. The document lists four names but does not provide any other context around them.
Functions are blocks of code that perform specific tasks in C programs. There are two types of functions - standard functions that are predefined like main(), printf(), scanf(), and user-defined functions created by the programmer. Functions can take parameters, return values, or do both. Functions can be called by value, where the value of an argument is passed, or by reference, where the address of an argument is passed, allowing the function to modify the original variable. Functions improve modularity, reusability, and code organization in C programs.
This slide show us to what is computer why we use in daily life . the role of computer in our life , radiotherapy, calculating etc. the computer is the 2nd invention of history
The document discusses time management and how to use time effectively. It defines time management as planning and controlling the time spent on activities. It recommends setting goals, prioritizing tasks, learning to delegate, making small schedule changes, setting deadlines, avoiding multitasking, and scheduling your day ahead to manage time well. The purpose of time management is to save time, reduce stress, have more control over responsibilities, and get more done.
Memory involves three main processes - encoding, storage, and retrieval. There are two main types of memory - explicit memory which we are consciously aware of, and implicit memory which is unconscious. The Atkinson-Shiffrin model describes memory as having three stages - sensory memory, short-term memory, and long-term memory. Information is encoded and either maintained briefly in sensory memory or transferred to short-term memory through rehearsal before being consolidated into long-term memory. Factors like decay, interference, and insufficient cues can lead to forgetting over time.
Motivation refers to factors that energize and direct behavior. There are four main components in the model of motivation: needs, drives, incentives, and goals. Needs are internal deficiencies that create tension and lead to drives, which motivate behavior to reduce discomfort. Incentives are external stimuli that pull behavior toward rewards. The goal is to reduce tension by meeting needs. There are intrinsic motivations from enjoyment of an activity and extrinsic motivations from external rewards. Motives include primary biological needs for survival and secondary learned needs from social interaction.
This document provides an introduction to the field of psychology. It discusses what psychology is, which is defined as the scientific study of human behavior and mental processes. It also outlines the main goals of psychology, which are to describe, explain, predict, and control or change behavior. Several major schools of thought in psychology are then introduced, including structuralism, functionalism, psychoanalysis, Gestalt psychology, and behaviorism. The document concludes by defining what research is in psychology and noting it involves systematically investigating topics to gain new knowledge.
The document discusses the seven C's of effective communication:
1) Completeness - Provide all relevant information for understanding. Answer the 5W1H questions.
2) Conciseness - Be brief and avoid unnecessary words.
3) Consideration - Understand the receiver's perspective and show how they will benefit.
4) Concreteness - Use specific examples, facts, and figures instead of vague language.
5) Clarity - Choose simple words and constructs and place the main idea up front.
6) Courtesy - Be respectful and avoid blunt statements.
7) Correctness - Use the appropriate level of language and check accuracy, grammar, spelling, and punctuation.
Sensation and Perception involves three main concepts:
1) Sensation is the activation of sense organs by a stimulus or source of physical energy. Perception is the interpretation and analysis of sensations by the sense organs and brain.
2) Psychophysics studies the relationship between the physical aspects of stimuli and our psychological experiences of them, such as absolute and difference thresholds.
3) Gestalt principles help us organize visual scenes into meaningful wholes, including principles of closure, similarity, and proximity which influence our perceptions of objects and groupings.
This document discusses different data types in C++. It begins by defining data as a set of values related to variables, and data types as determining the type and operations that can be performed on data. It then covers the main points that:
1) There are built-in/fundamental and derived/user-defined data types in C++. Built-in types include char, int, float, double, void and bool.
2) Derived types are composed of built-in types, such as arrays, structures, unions and classes.
3) User-defined types must be declared before use, such as struct, union, class and enumerations.
The document provides examples and
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
Assessment and Planning in Educational technology.pptxKavitha Krishnan
In an education system, it is understood that assessment is only for the students, but on the other hand, the Assessment of teachers is also an important aspect of the education system that ensures teachers are providing high-quality instruction to students. The assessment process can be used to provide feedback and support for professional development, to inform decisions about teacher retention or promotion, or to evaluate teacher effectiveness for accountability purposes.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
Executive Directors Chat Leveraging AI for Diversity, Equity, and InclusionTechSoup
Let’s explore the intersection of technology and equity in the final session of our DEI series. Discover how AI tools, like ChatGPT, can be used to support and enhance your nonprofit's DEI initiatives. Participants will gain insights into practical AI applications and get tips for leveraging technology to advance their DEI goals.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Physiology and chemistry of skin and pigmentation, hairs, scalp, lips and nail, Cleansing cream, Lotions, Face powders, Face packs, Lipsticks, Bath products, soaps and baby product,
Preparation and standardization of the following : Tonic, Bleaches, Dentifrices and Mouth washes & Tooth Pastes, Cosmetics for Nails.
2. Table of Contents
Overview…………………………………………………………2
Basic structure of program…………………… ………………4
Data type………………………………………… ………………8
Variable & Constants……………………………………………12
Decision Making & Branching ……………………………… 16
The loop………………………………………………………… 25
The Array………………………………………………………… 33
The Function………………………………………………………38
The Recursion…………………………………………………… 42
The pointer…………………………………………………………43
The String………………………………………………………… 47
The structure……………………………………………………… 49
Overview
C language
C is a general-purpose, high-level language that was originally
developed by
Dennis M. Ritchie to develop the UNIX operating system at Bell
Labs. C was
originally first implemented on the DEC PDP-11 computer in
1972.
3. In 1978, Brian Kernighan and Dennis Ritchie produced the first
publicly available
description of C, now known as the K&R standard.
The UNIX operating system, the C compiler, and essentially all
UNIX application
programs have been written in C. C has now become a widely
used professional
language for various reasons:
Easy to learn
Structured language
It produces efficient programs
It can handle low-level activities
It can be compiled on a variety of computer platforms
Facts about C
C was invented to write an operating system called UNIX.
C is a successor of B language which was introduced around the
early
1970s.
The language was formalized in 1988 by the American National
Standard
Institute (ANSI).
The UNIX OS was totally written in C.
Today C is the most widely used and popular System
Programming
Language.
Most of the state-of-the-art software have been implemented
using C.
Today's most popular Linux OS and RDBMS MySQL have been
written in
C.
Why Use C?
2
4. C was initially used for system development work, particularly the
programs that
make-up the operating system. C was adopted as a system
development
language because it produces code that runs nearly as fast as the code
written
in assembly language. Some examples of the use of C might be:
Operating Systems
Language Compilers
Assemblers
Text Editors
Print Spoolers
Network Drivers
Modern Programs
Databases
Language Interpreters
Utilities
Chapter 1
Basic structure of Program
C Programs
A C program can vary from 3 lines to millions of lines and it should be
written into one or more text files with extension ".c"; for example,
hello.c. You can use "vi", "vim" or any other text editor to write your C
program into a file.
This tutorial assumes that you know how to edit a text file and how to
write source code inside a program file
3
5. C language:
C language is language of computer. The maker of c language is
Dennis Richie in 1972 at bill lab.in using c language bill gate make
operating system, android operating system also make android apps
etc.
C language also known as basic language of computer
Now we discussed history of c language
History of C language
DennisRichiearemaker of C languagein 1972in billlab
Basic Structure of C language
Basicstructure is using structuring of programming where we discussed
aboutsection
Example:
documentation section, sub section and predefined etc.
We discussed one by one
There are 7 basics structuring section of programming.
1: Documentation section
The documentation sectionwhere we explained why we written
Example:
int main(int x,int y); //decelerated function//
*/------------/* used for locking / unlocked statements
4
6. 2: Link section
The link section is also known as library. library is predefined section
where we linked program to library.
Example
#include<stdio.h> //library section //
3: Defining section
The user defined in link sectionto all area using where it’s calling
Example:
#define max 50
4: Global Declaration section
A function/variable whichdeclared outside of body of programming in
globally
5: local declaration section
A function/variable which declared inside of body of programming is
Known as local declaration section
6: Main()
Main () is type of function where are declared/execute the statement.
Example:
Main ()
{
Printf(“sabeel bugti”);
//declaration
Scanf(“%d”); //Executable
5
7. }
7: Sub program section
The user defined function are declared area.
Main()
{
Function 1-----
Function 2-----
Function n--- //declared user defined function//
} First programming of C language
This is first programming in c language where we print “sabeel bugti”.
Basic Explain part of C language
# is the preprocessor and also known starting part of programming
Clrscr() is used for previous record.
Getch() is used of holding output during executables.
Printf() is used for outputting massage/statement.
Scanf() is used for reading statement/output massage.
6
8. “Sabeel Bugti” quotation is used as showing massage/statement.
Compiler: program first compile the program statement. When we code
are error in the compiler are dedicate by giving msg.
Execute: when our code corrects by checked by compiler. The executer
are execute the statement.
Save: save programming in massage.c etc.
Syntax: is a grammar/method of programming is call syntax.
There are three type of Error.
1: syntax (grammatical error).
2: Logical (un requirement output error).
3: Retune ( repeating error).
Chapter 2
DATA TYPE
Data .
Data is a set of values of subjects with respect
to qualitative or quantitative variables.
Example:
A,b,1,8,5 these things known as data
7
9. Data type.
A data type determines the type and the operations that
can be performed on the data. C++ provides various data
types and each data type is represented differently within
the computer's memory.
Classified of Basic Data Types in C+
There are many data-types available in C+
They are classified under two categories:
Built-In or Fundamental Data types
Derived or User-Defined Data types
8
10. Built-in Data Type
Built-indata types are the most basic data-types in C++.
The term built-in means that they are pre-defined in C++ andcan be
used directly in a program.
Example:
• Character char
• Integer int
• Floating point float
• Double floating point double
Apart from these, we also have void and bool data types.
Derived Datatype
They are composed of built-in data types.
Examples are :
array, structure, union, class, pointers etc.
User Define Data Type
User-defined data types are those which are first
declared and defined by the user before use.
Example:
struct ; union ; class; enumeration; are User defined types
9
11. Explain Data Type in C
Char: Characters refer to the alphabet, numbers and other characters
(such as {, @, #, etc.) defined in the ASCII character set.
Int: Numbers without the fractional part represent integer data. In C++,
the int datatype is used to store integers such as 4, 42, 5233, -32, -745.
Floating point Data Type: A floating-point data type is used to store real
numbers suchas 3 .28, 64. 755765, 8.01, -24.53.
Void: The void data type is used for specifying an empty parameter list
unction and return type for a function.
Bool : The boo1data type can hold only Boolean values, that is; either
true or false, where true represents 1 and false represents 0.
Array :
An array is a set of elements of the same data type thatare referred to
by the same name.
Function:
A function is a self-contained program segment thatcarries out a
pacific well-defined task.
Reference:
A reference is an alternative name for a variable. Thatis, a reference is
an alias for a variable in a program.
Knowing
10
12. Chapter 3
Variable and Constant in C
Variable def.
The variable is during programming in changed by changed
execution are known as variable
Syntax. Data type, variable name, ; semi colon.
Example. Int a;
Constant def.
11
13. The constant is value are constant in programming. It’s do not change
during execution.
syntax. Data type variable name = value and semi colon.
Example. Int a=100;
Operators
Operatordef.
Operator arealsoknown symbols(+,%,^,*,=).It’sis used in programin easily
understandablestatement.
Operators withuses.
Thegraphwhich show usesnameand example.
Assigning value to variable
Theprocessor methodwherewegiving valueto variable.Themethodknown as
assigningvalueto variable.
Syntax: return typevariablename= value;
12
14. Example int subject = 100;
Program to find asci value of a character in c
language.
The program which show value (in which already exit in library) of
character.
After the find value of keyboard key we find all key operators after this
programming.
Now we make program which show all operators and keyword ascii.
Let’s start program.
The program of ascii find all value of keyboard.
13
15. This program are all value of keyword which predefined in library.
Output of all asci program.
All code of ascii here which already declared in library. The value of these
thing.
Your assignment.
Your assignment is asci of “happy birthday”.
Note.
14
16. In turbo c++ sometime don’t executed.
Be practice because computer is practical. You get new thing
practice againand again.
Chapter 4
Decision making andbranching program
the program which bases of condition are make is called
decision making andbranching
there are 4 branching statement
1: if statement
2: switch statement
3: conditional operators statement
4: go to statement
(1) if statement
1: simple if
15
17. 2: if...else
3: nested of if base
4: Else if ladder
1: Simple if
syntax
if(condition)
{
statement;
}
Using this syntax, we make even number program.
Even number program using simple statement.
16
18. What is flowchart?
The flowchart is graphic representation of programming.
What is Algorithm?
The algorithm is step by step written / explain process is called
Algorithm.
Simple statement program algorithm.
*start the program to main ().
*get variable i.
*print mag “enter a number”.
*scan used the msg.
*used simple statement to putting condition.
*condition true then print number is even
*end of program.
2: If statement…. else.
17
19. The if statement and else are used more thansimple condition. We
used else.
Now we make program which after checking number is odd or even.
Let’s start the program.
Syntax: if(condition)
{ Statement;
}
Else
{statement;
}
Using syntax to make program even or odd.
The program which checked all condition than true value are printed.
Program flowchart.
18
20. The Algorithm of program.
*start the program to main().
*get integer variable no.
*print massage and read by scanf.
*used condition (if/else).
* compiler check true condition and printed true condition.
*end the program.
3: Nested if statement.
An if statement which statementinside another statement is known as
20
21. Nested if statement.
4: Else if ladder statement
the if else ladder are method of stair known wich we make pargram
stair/ladder.
Syntax. If(condition1)
{
Block1
}
Else If (condition 2)
{
Block 2
}
Else if (condition)
21
22. {
Block 3
}
Else
{
Block 4
}
Now we make calculator using of if else ladder statement.
So let’s start the program.
.
The calculator makes in if else ladder statement. Now if statement
process is completed.
22
23. Now switch statement.
3: Conditional operator statement
Conditional operator (? true) or (: false).the operator are decided which
is true and false.
Syntax. (condition)? expression1:expression2.
23
24. 4: go to statement.
Go to statement which start again and again using by the go to
statement.
24
25. Chapter 5
The Loop
Loop Def.
The repeating sequence of sentence/statement is called loop.
Flowchart of loop
There are five type of loop.
1: The While loop
2: The Do while loop
3: The for loop
4: The Nested loop
5: Jump in loop
25
26. Now we discussed these type of loop.
1: While loop
The while loop in c programing repeatedly executes a target
statement as longas given condition is true.
Syntax. While(condition)
{
Statement(s);
}
Now we make program using of syntax.
While loop is decided initialization when u get variable. After makes
requirement conditioned and incrementand decrement.
26
27. Flowchart of while loop.
2: Do while loop.
A Do while loop similar to a while loop but except In fact that is
guaranteed to execute at least once time.
Syntax. Do
{
Statement
Increment and decrement
}
While(condition)
27
29. 3: The For loop.
A for loop is a repetitioncontrol of structure that allows you to
efficiently write a loop thatneeds to executes a specific of number time.
Syntax. For(initialization; condition; increment and decrement)
For(i=1;i<=100;i++)
{
Statement;
}
Now helping of syntax we make program.
For loop are used in pointer (you will read in after passing two
chapter)
And now your assignment is
Make program helpof for loop print one number on screen.
And now flowchart of for loop.
29
30. 4: Nested loop.
C programming allow to use one loop to inside another loop.
The nested loop are used in any loop.
Syntax.
30
31. Now make program helping of syntax.
.
5: jump in loop/control loop.
The jump in loop which process where we skipping and continue loop.
There are two type of statement of jump loop.
1: Breaking loop.
The terminate the loop statementand transfers execution to
the statement immediately.
2: Continueloop.
Causes the loop to skip the remainder of its body and
immediatelyretest its conditionprior to reiterating.
Now it’s time to making program of jump in loop.
Program jump in loop.
31
33. The Array
The array def.
The collection of same data type is knownas array.
Another definition of Array.
Arrays a kind of data structure that can store a fixed-size sequential
collection of elements of the same type. An array is used to store a
collection of data.
Syntax. Return type variable name[argument] and semicolon.
Example. type array Name [ array Size ];
There are three type of array
1: One dimensional array
2: Two dimensional array
3: Multiple dimensional array
1: One dimensional array.
The one dimensional array which subscript is one is known as 1d (one
dimensional) array.
Syntax. type array Name [ array Size];
Let’s make program help of syntax.
33
34. 1:Two-dimensional Arrays.
The simplest form of multidimensional array is the two-dimensional
array. A two-dimensional array is, in essence, a listof one-dimensional
arrays. To declare a two-dimensional integer array of size [x][y]
Syntax. type array Name [ x] [ y];
Now make program help of syntax.
34
35. 3: Multiple dimensional array.
C programming language allows multidimensional arrays. Here is the
general form of a multidimensional array declaration.
Syntax. type name[size1] [size2]...[size n];
Example. int threedim [5] [10] [4];
Let’s make program help of syntax.
Passing Arrays as Function Arguments.
pass a single-dimension array as an argument in a function, you
would have to declare a formal parameter in one of following three ways
and all three declaration methods produce similar results.
35
36. Program to merge two arrays and sorting in third array.
The program whichmake two array merge and get another array to
sorting both of arrays.
Example. 36
37. The merge program is your assignment.
Chapter 7
The Function
The function def. 37
38. A function is a group of statements that together perform a task.
Every C program has at least one function, which is main().
A function definitionin C programming consists of a function header
and a function body. Here are all the parts of a function:
Return Type:
A function may return a value. The return type is the data type of the
value the function returns. Some functions perform the desired
operations without returning a value. In this case, the return type is the
keyword void.
Function Name:
This is the actual name of the function. The function name and the
parameter list together constitute the function signature.
Parameters:
A parameter is like a placeholder. When a function is invoked, you pass
a value to the parameter. This value is referred to as actual parameter or
argument. The parameter list refers to the type,
order, and number of the parameters of a function. Parameters are
optional; that is, a function may contain no parameters.
Function Body:
The functionbody contains a collection of statements that define what
the function does.
Function Type
There are two type of function.
1: Built in function
The function whichalready defined in library.
Example. getch (), clrscr (), printf () and scanf () etc.
38
39. 2: User defined Function.
The function which declared/defined by user.
Example void disp (int, int); , #define max50 etc.
And now discussed element / method of user defined function.
There are three method of function.
1: Function declaration (optional).
2: Function defining.
3: Function call.
1: Function Declarations
A function declaration tells the compiler about a function name and how
to call the function. The actual body of the function can be defined
separately.
Syntax: return type function_name (parameter list );.
2: FunctionDefining.
A function definition provides the actual body of the function. The
function defining the declared function.
Syntax: return_type function_name( parameter list )
{
body of the function
}
3: Functioncall.
The function call is called parameter function in actual body of program.
39
40. Example. Function name (a, b);
There are two type of function call.
1: call by value.
The call by value method of passing arguments to a function copies the
actual value of an argument into the formal parameter of the function. In
this case, changes made to the parameter inside the function have no
effect on the argument.
Methods
void swap(int x, int y)
{
int temp;
temp = x; /* save the value of x */
x = y; /* put y into x */
y = temp; /* put temp into y */
return;
}
2: Call by reference(* reference).
The call by reference method of passing arguments to a function copies
the address of an argument into the formal parameter. Inside the
40
41. function, the address is used to access the actual argument used in the
call. It means the changes made to the parameter affect the passed
argument.
Method.
/* function definition to swapthe values */
void swap(int *x, int *y)
{
int temp;
temp = *x; /* save the value at address x */
*x = *y; /* puty intox */
*y = temp; /* put temp into y */
Category of Function
There are four category of function.
1: Function with arguments and return value.
e.g int add(int x ,inty)
2: function with argument andno return value.
e.g voidadd(intx , int y)
3: function with no argument and return value.
E.g int add(void)
4: Function with no argument and no return value.
e.g void add(void)
Chapter 8
41
42. The Recursion
Recursion def.
The Function which call function inself is known is recursion of the
fuction. The recusrionis requirement one functions as compare of nested
function.
Recursion Syntax.
int sub(int x)
int i,a;
-------
-------
I=sub(a); // Recursion
And Now helpof syntax make program of Recursion.
The Recursion program function declared thandefining there.
Chapter 9
42
43. The Pointer
Pointer def.
The pointer is specific variable which hold the address of another
variable. The pointer also known as reference and both of same symbol *.
Syntax.
{
Int a=100;
Int *p;
P=&a;
}
And now we make small program of pointer.
This program show how its’s value and address are holdby pointer.
Array Of Pointer
43
44. The process where we used array for many of same pointer is known as
array of pointer.
Syntax.
{
Int marks[]={10,20,30};
Int *pointer[3];
}
Here is program.
Pointer to Pointer.
The point/hold the pointer address is known as pointer to pointer or
chain of pointer.
Syntax.
44
45. And now make program of pointer to pointer help of given syntax.
Pointer to use in function.
The pointer passing in function as known as pointer passing in function.
C programming allows passing a pointer to a function. To do so, simply
declare the function parameter as a pointer type.
45
46. Explain program.
After linked to library program comes in function defining.write both
of them before swaping and before swaping . the swapping process is
t=*x here we value of x transfer in t than value of *y equal in *x here are
exchanging process. t value transfer in *y. I and j are store in *x and *y.
Chapter 10
46
47. The String
String def.
Strings are actually one-dimensional array of characters terminated by
a null character '0'. Thus a null-terminated string contains the characters
that comprise the string followed by a null.
Syntax.
char greeting [7] = {'s', 'a', 'b', 'e', 'e',’l’ '0'};
Program.
The program where we finding value, address and length of one by one
character.
47
48. Explain Program.
The program starts in main function. Gets string variable name and pass
parameter/argument thangive another variable to access and increment
for the string. The not (!) used for length of string also equal of the null 0.
Chapter 12
The Structure
Structure Def. 48
49. The structure is collection of the different data type. The keyword is
struct. The structure variable are declared in main() or after of curely
bracket.
structure is handle two and more member at that time.
structure size is equal is members size.
the members of address are madeup in sequencely,structure value
are not went one place to another place.
Syntax. struct struct name
{
<datatype> member 1;
<datatype> member 2;
}structure variable;
Declared main function syntax.
Struct struct name/tagvari1,vari2,vari3….vari n;
Example
int ,char,float are collection of different data type.
Person datail
Identity card
Name character value
Salary. Integer value
Etc.
Access of member in structure.
The structure which declared datatype these data type is called member
which we need variable to acess.structure is handle two and more
49
49
50. member at that time.structure size is equal is members size.the members
of address are madeup in sequencely,structure value are not wentone
place to another place.
(.)dot are used for access.
How ?
Structure variable . Structure member
There two mathod of access member.
First mathod
Secondmathod
Structure variable. Structure member
Struct
{
Int roll;
Char name[10];
}sturct={101,”sabeel”};
Printf(“roll number is %d”,struct.rool);
Struct student
{
Int roll;
Char name [10];
};
50
52. Array of Structure.
The array of structure are collection of different datatype which
collect different person.
Example result of five student.
Syntax.
Int mark [10];
Struct student
{
-------roll no;
-------name ;
} stu[5];
Here program.
52
53. Structure in structure / Nested in structure.
C program are allowed to structure have inside another structure as
known as struture in structure or nested in structure.
Syntax.
53
54. Accessing.
Calling outer variable
Outer variable . member1;
Calling inner variable
Outer variable . inner variable . member1;
And now make nested program help of syntax.
54
56. Chapter 13
The Union
Union Def.
The Union is collection of the different data type. store different data
types in the same memory location. You can define a union withmany
members, but only one member can contain a value at any given time.
The keyword is union. The union variable are declared in main() or after of
curely bracket.
union is handle one member at that time.
union size is equal is large members size.
The union member address in one cause when it’s large size
overwrite value is execute well but other variable during of
executed garbage value .
Syntax. union union name
{
<datatype> member 1;
<datatype> member 2;
}unionvariable;
56