बिजनेस मार्केटिंग का लो कॉस्ट फंडा , अपने मोबाइल से ऑटो sms भेजकर मार्केटिंग करे विजिट करे http://autotextsms.com/ बिजनेस मार्केटिंग का लो कॉस्ट फंडा http://autotextsms.com/

Search This Blog

Translate

Distinguish between malloc() and calloc(), break and continue


Write Distinguish between malloc() and calloc(),

Distinguish between break and continue.with example,

 write differences between malloc() and calloc(),
differences  between break and continue.

 explain Malloc() ,Calloc(),expain breax, explain continue,




Distinguish between malloc() and calloc()
malloc()
calloc()
malloc() is used to allocate memory space in bytes
calloc() is sued to allocate multiple blocks of memory dynamically during the execution (run - time) of the program
Syntax: pointer=
(data_type*)malloc(user_defined_size);
Syntax:pointer=(data_type*)calloc(no of memory blocks, size of
each block in bytes);

e) Distinguish between break and continue.
The break statement will immediately jump to the end of the current block of code.
The continue statement will skip the rest of the code in the current loop block and will return to the evaluation part of the loop. In a do or while loop, the condition will be tested and the loop will keep executing or exit as necessary. In a for loop, the counting expression (rightmost part of the for loop declaration) will be evaluated and then the condition will be tested.
Example:
#include main() { int i; int j = 10; for( i = 0; i <= j; i ++ ) { if( i == 5 ) { continue; } printf("Hello %d\n", i ); } }

#include main() { int i; int j = 10; for( i = 0; i <= j; i ++ ) { if( i == 5 ) { continue; } printf("Hello %d\n", i ); } }

#include main() { int i; int j = 10; for( i = 0; i <= j; i ++ ) { if( i == 5 ) { continue; } printf("Hello %d\n", i ); } }

for(int i = 0; i < 10; i++){
if(i == 0) continue;
DoSomeThingWith(i);
}
will not execute DoSomeThingWith for i = 0, but the loop will continue and DoSomeThingWith will be executed for i = 1 to i = 9.

C Program example List