While Loop Structure while (condition) { …. // This line will process when while condition is true }

Slides:



Advertisements
Similar presentations
C Language.
Advertisements

C Characters & Strings Character Review Character Handling Library Initialization String Conversion Functions String Handling Library Standard Input/Output.
 2003 Prentice Hall, Inc. All rights reserved Fundamentals of Characters and Strings Character constant –Integer value represented as character.
Strings.
1 Chapter 10 Strings and Pointers. 2 Introduction  String Constant  Example: printf(“Hello”); “Hello” : a string constant oA string constant is a series.
Lecture 09 Strings, IDEs. METU Dept. of Computer Eng. Summer 2002 Ceng230 - Section 01 Introduction To C Programming by Ahmet Sacan Mon July 29, 2002.
Character String Manipulation. Overview Character string functions sscanf() function sprintf() function.
Character String Manipulation. Overview Character string functions sscanf() function snprintf() function.
Lecture 9. Lecture 9: Outline Strings [Kochan, chap. 10] –Character Arrays/ Character Strings –Initializing Character Strings. The null string. –Escape.
Lecture 20 Arrays and Strings
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
Strings CS240 Dick Steflik. What is a string A null terminated array of characters: char thisIsAString[10]; \0 The “\0” (null character)
 2000 Prentice Hall, Inc. All rights reserved Fundamentals of Strings and Characters String declarations –Declare as a character array or a variable.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Characters and Strings.
Current Assignments Homework 5 will be available tomorrow and is due on Sunday. Arrays and Pointers Project 2 due tonight by midnight. Exam 2 on Monday.
Chapter Fourteen Strings Revisited. Strings A string is an array of characters A string is a pointer to a sequence of characters A string is a complete.
Pointers in C Rohit Khokher
Searching and Sorting an Array 4 Searching and sorting are two fundamental algorithms often implemented with arrays –Search an array to determine the location.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 8 - Characters and Strings Outline 8.1Introduction 8.2Fundamentals of Strings and Characters 8.3Character.
Chapter 8 Characters and Strings Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Fundamentals of Strings and Characters Characters.
C-Strings A C-string (also called a character string) is a sequence of contiguous characters in memory terminated by the NUL character '\0'. C-strings.
To remind us We finished the last day by introducing If statements Their structure was:::::::::
CSSE221: Software Dev. Honors Day 28 Announcements Announcements Simulation grades coming back Simulation grades coming back All C Projects due Friday.
Strings String - a string is a series of characters treated as a unit. A C string is a variable-length array of characters that is delimited by the null.
C Slides and captured lecture (video and sound) are available at:
 2007 Pearson Education, Inc. All rights reserved C Characters and Strings.
Strings in C. Strings are Character Arrays Strings in C are simply arrays of characters. – Example:char s [10]; This is a ten (10) element array that.
 2007 Pearson Education, Inc. All rights reserved C Characters and Strings.
Introduction to C programming
C Programming Tutorial – Part I CS Introduction to Operating Systems.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 8 - Characters and Strings Outline 8.1Introduction 8.2Fundamentals of Strings and Characters 8.3Character.
BBS514 Structured Programming (Yapısal Programlama)1 Character Processing, Strings and Pointers,
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 12: Pointers continued, C strings.
Characters and Strings File Processing Exercise C Programming:Part 3.
 2008 Pearson Education, Inc. All rights reserved Pointers and Pointer-Based Strings.
Lecture 22: Reviews for Exam 2. Functions Arrays Pointers Strings C Files.
Chapter 8 Characters and Strings Associate Prof. Yuh-Shyan Chen Dept. of Computer Science and Information Engineering National Chung-Cheng University.
Arrays II (Strings). Data types in C Integer : int i; Double: double x; Float: float y; Character: char ch; char cha[10], chb[]={‘h’,’e’,’l’,’l’,’o’};
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI C-Style Strings Strings and String Functions Dale Roberts, Lecturer.
Chapter 8: Character and String CMPD144: Programming 1.
Review of Lectures 12, 13, 14 -Functions -Arrays -Strings.
CSC141- Introduction to Computer programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture – 21 Thanks for Lecture Slides:
Strings Programming Applications. Strings in C C stores a string in a block of memory. The string is terminated by the \0 character:
 2003 Prentice Hall, Inc. All rights reserved. 5.11Function Pointers Pointers to functions –Contain address of function –Similar to how array name is.
 2003 Prentice Hall, Inc. All rights reserved. 11 Fundamentals of Characters and Strings Character constant –Integer value of a character –Single quotes.
UniMAP SEM I - 09/10EKT 120 Computer Programming1 Lecture 8 – Arrays (2) & Strings.
Chapter 8 Characters and Strings. Objectives In this chapter, you will learn: –To be able to use the functions of the character handling library ( ctype).
C++ Programming Lecture 19 Strings The Hashemite University Computer Engineering Department (Adapted from the textbook slides)
1 Pointers: Parameter Passing and Return. 2 Passing Pointers to a Function Pointers are often passed to a function as arguments  Allows data items within.
1 Arrays and Pointers The name of an array is a pointer constant to the first element. Because the array’s name is a pointer constant, its value cannot.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Characters and Strings Dale Roberts, Lecturer Computer Science,
Strings. String Literals String literals are enclosed in double quotes: "Put a disk in drive A, then press any key to continue\n“ A string literal may.
ECE 103 Engineering Programming Chapter 29 C Strings, Part 2 Herbert G. Mayer, PSU CS Status 7/30/2014 Initial content copied verbatim from ECE 103 material.
Principles of Programming - NI Chapter 10: Character & String : In this chapter, you’ll learn about; Fundamentals of Strings and Characters The difference.
C Characters and Strings
INC 161 , CPE 100 Computer Programming
C Characters and Strings
C Programming Tutorial – Part I
Programming Languages -1 (Introduction to C) strings
CSE 303 Lecture 14 Strings in C
Chapter 8 - Characters and Strings
Pointers Department of Computer Science-BGU יום רביעי 21 נובמבר 2018.
Pointers and Pointer-Based Strings
Strings Adapted from Dr. Mary Eberlein, UT Austin.
Strings #include <stdio.h>
Programming Languages and Paradigms
Characters and Strings Functions
Strings Adapted from Dr. Mary Eberlein, UT Austin.
C Characters and Strings
Presentation transcript:

While Loop Structure while (condition) { …. // This line will process when while condition is true }

do - While Loop Structure do { …. // This line will process first then check while condition } while (condition); // if while condition is true then process inside do again

For Loop Structure for (initial; condition; increment) { …. // This line will process when for condition is true } initial = initialize value of index (do at once) Condition = check whether true or false Increment = after process then define the increment or decrement of index

Nested For Loop Structure for (initial; condition; increment) { …. (outer loop line) for (initial; condition; increment) { …. (inner loop line) } ….. (outer loop line) }

How to use “FOR” instead of “WHILE” in the following example main() { int i; i =1; while(i <= 10) { printf(“%d”,i); i = i+1; }

How to use “FOR” instead of “WHILE” in the following example main() { int i; i =1; while(i <= 10) { printf(“%d”,i); i =i+1; } main() { int i; for (i=1;i <= 10;i=i+1) { printf(“%d”,i); }

A1 : Given The Following Code

i = 0 ; max = 6 ; Solution: Loop1 : i=0, max=6  0 Loop2 : i=3, max=6  3 Loop3 : i=6, max=6 

A1 : Given The Following Code i = 0 ; max = 6 ; Result: 03

A1 : Given The Following Code i = -3 ; max = 6 ; Solution: Loop1 : i=-3, max=6  -3 Loop2 : i=0, max=6  0 Loop3 : i=3, max=6  3 Loop4 : i=6, max=6 

A1 : Given The Following Code i = -3 ; max = 6 ; Result: -303

A1 : Given The Following Code i = 2 ; max = ++i +i +3 ; Solution: Loop1 : i=3, max=9  3 Loop2 : i=6, max=9  6 Loop3 : i=9, max=9  ++i + i +3 =  9

A1 : Given The Following Code i = 2 ; max = ++i +i +3 ; Result: 36

A1 : Given The Following Code max = 8 ; i = max/2; Solution: Loop1 : i=4, max=8  4 Loop2 : i=7, max=8  7 Loop3 : i=10, max=8 

A1 : Given The Following Code max = 8 ; i = max/2; Result: 47

A2 : What is the output of the following program?

Result: x is 3(n=7) Solution: Loop1 : x=15, n=4  13 Loop2 : x=13, n=4  11 Loop3 : x=11, n=4  9 Loop4 : x=9, n=4  7 Loop5 : x=7, n=4  5 Loop6 : x=5, n=4  3 Loop7 : x=3, n=4 

B9 : What is the output of the following program?

#include int main(void) { int x; for(x=3;x<20;x++) { if(x==5) continue; if(x==10) break; printf("%d ",x); } return 0; } Result: b Output Loop1(x=3)  3 Loop2(x=4)  4 Loop3(x=5)  continue; Loop4(x=6)  6 Loop5(x=7)  7 Loop6(x=8)  8 Loop7(x=9)  9 Loop3(x=10)  Break;

B11 : In the following C program, how many times will i be printed out on the screen?

B11 : In the following C program, how many times will i be printed out on the screen? #include int main(void) { int i=10; do{ printf("i"); i++; }while(i<10); } Result: d. 1 Output Loop1(i=10)  i Loop2(i=11) 

Array Structure int digits[10] = {1,2,3,4,5,6,7,8,9,10}; static float x[6] = { 0,0.25,0,0.50,0,0}; char color[] = {'R','E','D'}; char color2[] = "RED" digits[0] = 1 x[0] = 0 color[0] = 'R‘ digits[1] = 2 x[1] = 0.25 color[1] = 'E' digits[2] = 3 x[2] = 0 color[2] = 'D' digits[3] = 4 x[3] = 0.50 digits[4] = 5 x[4] = 0 color2[0] = 'R' digits[5] = 6 x[5] = 0 color2[1] = 'E' digits[6] = 7 color2[2] = 'D' digits[7] = 8 color2[3] = '\0' digits[8] = 9 digits[9] = 10

Link to Bubble Sort Example

B5:

Solution: a.int a[3]={2,3,4};  b.int a[] = {2,3,4};  c.int a[5] = {2,3,4};  d.int a[3] = {2,3,4,0,0}; 

B6: 5 Rows 4 Columns

B6: Solution: a.int array[10][4];  array with 10 rows and 4 columns b.int array[4][10];  array with 4 rows and 10 columns c.int array[4,10];  ERROR d.int a {10} {4};  ERROR

B18:

B10:

String is defined as an ARRAY of CHARACTERS String is terminated by a special character which is null parameter (\0). We declare a string by char color[] = “blue”; char color[] = {‘b’, ‘l’, ‘u’, ‘e’,‘\0’}; char msg[10] = “Computer”; char msg[10] = {‘C’,’o’,’m’,’p’,’u’,’t’,’e’,’r’,’\0’};

String Input Functions scanf (“%s”,name);  Scan until first space gets(name);  Scan until end of line sscanf(data,”%s”,name);  Read from data and keep string in name EXAMPLE: This is a Book scanf : This gets: This is a Book sscanf : This

String Output Functions #include main() { int i; char name[]= “Smith”; printf(“Name = %s”, name); puts(name); for(i=0;i<5;i++) { printf(“%c”, name[i]); }

Link to Example of ctype.h

string.h strcat(); Appends the string pointed to by str2 to the end of the string pointed to by str1. strncat(); Appends the string pointed to by str2 to the end of the string pointed to by str1 up to n characters long. strchr(); Searches for the first occurrence of the character c (an unsigned char) in the string pointed to by the argument str. strcmp(); Compares the string pointed to by str1 to the string pointed to by str2. strncmp(); Compares at most the first n bytes of str1 and str2. Stops comparing after the null character. strcpy(); Copies the string pointed to by str2 to str1. strncpy(); Copies up to n characters from the string pointed to by str2 to str1.

string.h strcspn(); Finds the first sequence of characters in the string str1 that does not contain any character specified in str2. strlen(); Computes the length of the string str up to but not including the terminating null character. strpbrk(); Finds the first character in the string str1 that matches any character specified in str2. strrchr(); Searches for the last occurrence of the character c (an unsigned char) in the string pointed to by the argument str. strspn(); Finds the first sequence of characters in the string str1 that contains any character specified in str2. strstr(); Finds the first occurrence of the entire string str2 (not including the terminating null character) which appears in the string str1. strtok(); Breaks string str1 into a series of tokens. strxfrm(); Transforms the string str2 and places the result into str1.

B13:

B21:

Solution printf("%d %c %c\n", toupper('a')+1, toupper('b')+1, tolower('C')-2); toupper('a')+1  A (65) +1 = 66  %d  66 toupper('b')+1  B(66) +1 = 67  %c  C tolower('C')-2);  c(99) – 2 = 97  %c  a

B14:

B22:

Solution a. string.h  This header file defines several functions to manipulate C strings and arrays b. stdio.h  This header file for the standard functions that deal with input and output c. stdlib.h  This header defines several general purpose functions, including dynamic memory management and random d. ctype.h  This header allow the programmer to check, compare, and manipulate characters

A5:

Write a single statement to accomplish each of the following. Assume that variables c (which stores a character) is of type int, and arrays s1[100] and s2[100] are of type char. 5.1 Convert the character stored in variable c to an uppercase letter. Assign the result to variable c.

A5: Write a single statement to accomplish each of the following. Assume that variables c (which stores a character) is of type int, and arrays s1[100] and s2[100] are of type char. 5.1 Convert the character stored in variable c to an uppercase letter. Assign the result to variable c. #include main() { int c = 'a'; c = toupper(c); printf("%c",c); } Answer

A5: Write a single statement to accomplish each of the following. Assume that variables c (which stores a character) is of type int, and arrays s1[100] and s2[100] are of type char. 5.2 Convert the string “8.635” to double and print the value.

A5: Write a single statement to accomplish each of the following. Assume that variables c (which stores a character) is of type int, and arrays s1[100] and s2[100] are of type char. 5.2 Convert the string “8.635” to double and print the value. #include main() { char s2[100] = "8.635"; printf("%.3f",atof(s2)); } Answer

A5: Write a single statement to accomplish each of the following. Assume that variables c (which stores a character) is of type int, and arrays s1[100] and s2[100] are of type char. 5.3 Copy the string stored in array s2 into array s1.

A5: Write a single statement to accomplish each of the following. Assume that variables c (which stores a character) is of type int, and arrays s1[100] and s2[100] are of type char. 5.3 Copy the string stored in array s2 into array s1. #include main() { char s1[100], s2[100] = "8.635"; strcpy (s1,s2); printf("%s",s1); } Answer

A5: Write a single statement to accomplish each of the following. Assume that variables c (which stores a character) is of type int, and arrays s1[100] and s2[100] are of type char. 5.4 Determine the length of the string in s1. Print the result.

A5: Write a single statement to accomplish each of the following. Assume that variables c (which stores a character) is of type int, and arrays s1[100] and s2[100] are of type char. 5.4 Determine the length of the string in s1. Print the result. #include main() { char s1[100] = "8.635"; printf("%d",strlen(s1)); } Answer

Why? Main reason – Often be used more than once in a program – Fit naturally with a top-down design approach – Provide a natural method for dividing a programming task among team – Can be tested individually

Example: No Output void print_hi() { printf(“Hi”); } No Output

Example: No Input void print_hi() { printf(“Hi”); } void print_hi(void) { printf(“Hi”); } No Input

Example: Input as Integer int factorial(int n) { int ans=1; int i; for (i=2;i<n;i++) { ans*=i; } return ans; } n is input

Example: Output as Integer int factorial(int n) { int ans=1; int i; for (i=2;i<n;i++) { ans*=i; } return ans; } Output as Integer Output value of ans

Example: Two Input void print_chars(char ch, int n) { int i; for (i=0;i<n;i++) { printf(“%c”,ch); }

Function Prototypes double cal_area(double r); void main() { … area= cal_area(r); … } double cal_area(double r) { return 3.14*r*r; } double cal_area(double r) { return 3.14*r*r; } void main() { … area= cal_area(r); … }

Global vs Local Variable int pi=3.14; double cal_area(double r) { return pi*r*r; } void main() { … area= cal_area(r); cir= 2*pi*r; } double cal_area(double r) { int pi=3.14; return pi*r*r; } void main() {… int pi=3.14; area= cal_area(r); cir = 2*pi*r; }

Extract function from code void main() { double r,area; printf(“input radius>”); scanf(“%lf”,&r); area= 3.14*r*r; printf(“area is %lf”,area); } r is an input Type of r is double Need to output as double Link to Example of Function

B4:

Global Variables Local Variables

B4: Solution: a.local variable;  A variable defined inside a function b.general variable  A variable as input to the function c.prototype variable  A function prototype is a function header without implementation. d. global variable  A variable defined outside a function

B7:

What is the output? #include int x,y,z; void junk(int x,int y,int z) { x++; y++; z++; printf(“%10d%10d%10d\n”,x,y,z); } main() { x=1; y=2; z=3; printf(“%10d%10d%10d\n”,x,y,z); junk(x,y,z); printf(“%10d%10d%10d\n”,x,y,z); }

What is the output? #include int x,y,z; void junk(int x,int y,int z) { x++; y++; z++; printf(“%10d%10d%10d\n”,x,y,z); } main() { x=1; y=2; z=3; printf(“%10d%10d%10d\n”,x,y,z); junk(x,y,z); printf(“%10d%10d%10d\n”,x,y,z); }

What is the output? #include int x,y,z; void junk(int *x,int *y,int *z) { (*x)++; (*y)++; (*z)++; printf(“%10d%10d%10d\n”,*x,*y,*z); } main() { x=1; y=2; z=3; printf(“%10d%10d%10d\n”,x,y,z); junk(&x,&y,&z); printf(“%10d%10d%10d\n”,x,y,z); }

What is the output? #include int x,y,z; void junk(int *x,int *y,int *z) { (*x)++; (*y)++; (*z)++; printf(“%10d%10d%10d\n”,*x,*y,*z); } main() { x=1; y=2; z=3; printf(“%10d%10d%10d\n”,x,y,z); junk(&x,&y,&z); printf(“%10d%10d%10d\n”,x,y,z); }

Call by Reference We can solved problem of multiple output from function using Call by Reference Link to Example of Call by Reference

B1:

Solution: a.int x;  creates a variable x as integer type b.ptr x;  Not found this type of declaration c.int &x;  creates a reference to an int named 'x' d.int *x;  x is a pointer to an integer

B2:

Solution: a.*a;  value of memory address of variable named 'a' b.a;  variable named 'a c.&a;  memory address of variable named 'a' d.address(a);  function named 'address'

B15:

B16:

Solution: a.char *  Example: “123”, “123abc”, ”abc” b.float *;  Example: 1.23, 1.0, 100 c.int  Example: 1, 2, 3, 10, 100, 1000 d.char  Example: ‘a’, ‘b’, ‘1’, ‘2’, ‘3’

B17:

Solution: a.char *s=“Test”  b.char s[5]={'t','e','s','t',0};  c.char s[]=“Hello”  d.char s[5]=“Hello”  TEST\0 TEST Hello

B20:

2 p 3451 a. p=a+3; 2 p 3451 c. p++; d. *q=(*p); P q

B3:

Solution: a.*p;  value of the variable pointed to by pointer p b.p;  memory address of the variable pointed to by pointer p c.&p;  memory address of pointer p d.address(p);  function named 'address'

B12:

A4 : What is the output of the following program? Link to Solution

A4 : What is the output of the following program? Result: x = 32 y = 20

Structure Structures are the C equivalent of records. A structure type can define in 2 ways, which are struct Foo { int x; int array[100]; }; Usage: struct Foo f; f.x = 54; f.array[3]=9; typedef struct { int x; int array[100]; } Foo; Usage: Foo f; f.x = 54; f.array[3]=9; Link to Example of Structure

Structure Passing Structs as Parameters Structs are passed by value, just like primitives void func(struct Foo foo){ foo.x = 56; foo.array[3]=55; } void main(){ struct Foo f; f.x = 54; f.array[3]=9; func(f); printf("%d and %d",f.x,f.array[3]); }

Structure Passing Structs as Parameters To have changes occur, send a pointer to the struct void func(struct Foo* foo){ (*foo).x = 56; (*foo).array[3]=55; } void main(){ struct Foo f; f.x = 54; f.array[3]=9; func(&f); printf("%d and %d",f.x,f.array[3]); }

What will be the output of the following code and why? #include typedef struct { char *a, *b, *c; } colors; void funct(colors sample){ sample.a = “Cyan”; sample.b = “Brown”; sample.c = “Yellow”; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); } main() { colors sample = {“red”, “green”, “blue”}; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); funct(sample); printf(“%s %s %s\n”, sample.a,sample.b,sample.c); }

What will be the output of the following code and why? #include typedef struct { char *a, *b, *c; } colors; void funct(colors sample){ sample.a = “Cyan”; sample.b = “Brown”; sample.c = “Yellow”; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); } main() { colors sample = {“red”, “green”, “blue”}; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); funct(sample); printf(“%s %s %s\n”, sample.a,sample.b,sample.c); } red green blue Cyan Brown Yellow red green blue

If we want output as followed, how to change the program? #include typedef struct { char *a, *b, *c; } colors; void funct(colors sample){ sample.a = “Cyan”; sample.b = “Brown”; sample.c = “Yellow”; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); } main() { colors sample = {“red”, “green”, “blue”}; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); funct(sample); printf(“%s %s %s\n”, sample.a,sample.b,sample.c); } red green blue Cyan Brown Yellow

If we want output as followed, how to change the program? #include typedef struct { char *a, *b, *c; } colors; void funct(colors *sample){ sample.a = “Cyan”; sample.b = “Brown”; sample.c = “Yellow”; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); } main() { colors sample = {“red”, “green”, “blue”}; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); funct(sample); printf(“%s %s %s\n”, sample.a,sample.b,sample.c); } red green blue Cyan Brown Yellow

If we want output as followed, how to change the program? #include typedef struct { char *a, *b, *c; } colors; void funct(colors *sample){ sample.a = “Cyan”; sample.b = “Brown”; sample.c = “Yellow”; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); } main() { colors sample = {“red”, “green”, “blue”}; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); funct(&sample); printf(“%s %s %s\n”, sample.a,sample.b,sample.c); } red green blue Cyan Brown Yellow

If we want output as followed, how to change the program? #include typedef struct { char *a, *b, *c; } colors; void funct(colors *sample){ (*sample).a = “Cyan”; (*sample).b = “Brown”; (*sample).c = “Yellow”; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); } main() { colors sample = {“red”, “green”, “blue”}; printf(“%s %s %s\n”, sample.a,sample.b,sample.c); funct(&sample); printf(“%s %s %s\n”, sample.a,sample.b,sample.c); } red green blue Cyan Brown Yellow

B27:

B8: C++ Spring 2000 Arrays typedef struct tnode { int a,b,c,d;} node; main() { node x; int *msg = &x;} 2 msg 345 x.a x.b x.c x.d

B8: C++ Spring 2000 Arrays typedef struct tnode { int a,b,c,d;} node; main() { node x; int *msg = &x;} 2 msg 345 x.a x.b x.c x.d 4 Bytes

Use the given part of the program to answer questions 28-30

B28:

B29: 4 Byte 40 Byte 118 Byte 4 Byte

B29: 4 Byte 40 Byte 118 Byte 4 Byte

B30:

Wrong type argument NULL undeclared

A3 : What is the output of the following program? Link to Solution

A3 : What is the output of the following program? Result: 8 6 6

B19: Solution: a.fseek  sets the file position indicator for the stream pointed to by stream. b.fscanf  read data from file into specified variable. c.rewind  Moving the file position marker back to the beginning of the file. d.feof  Check whether the end-of-file marker is reached.

B19: Solution: a.fseek  sets the file position indicator for the stream pointed to by stream. b.fscanf  read data from file into specified variable. c.rewind  Moving the file position marker back to the beginning of the file. d.feof  Check whether the end-of-file marker is reached.

B23:

B24:

B25:

B26: