Sunday, August 1, 2024

Compile Time Initializing 1-D Array [ Different Methods ] in C Programming




Different Methods of Compile Time Initializing 1-D Array
  1. Size is Specified Directly
  2. Size is Specified Indirectly
Method 1 : Size Specified Directly
  • Here Size of an Array is Specified Directly.
  • Example :
int num[5] = {2,8,7,6,0};
  • Size of An Array : 5
  • As at Compile Time All Elements are at Specified Position So This Initialization Scheme is Called as "Compile Time Initialization"
C Programming Array 1-D
Method 2 : Size Specified Indirectly
  • Here Size of an Array is Specified Indirectly.
  • Example :
int num[] = {2,8,7,6,0};
  • Indirectly Compiler Counts the Number Of Elements Written Inside Pair of Braces and Determines the Size of An Array .
  • Here Array Size is 5
  • This Initialization Scheme is also Called as "Compile Time Initialization"

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

 

Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates