UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

How do you declare and initialize an array?

Asked by Last Modified  

Follow 2
Answer

Please enter your answer

C language Faculty (online Classes )

There are two ways you can declare and initialize an array in Java. The first is with the new keyword, where you have to initialize the values one by one. The second is by putting the values in curly braces.
Comments

Experienced Computer trainer having worked in IT sector for 20 years.

You can declare an array of any data type (i.e. int, float, double, char) in C. The following ways can be used to declare and initialize an array in C. Array Declaration by Specifying the Size Arrays can be declared by specifying the size or the number of array elements. The size of the array specifies...
read more

You can declare an array of any data type (i.e. int, float, double, char) in C. The following ways can be used to declare and initialize an array in C. 

 

Array Declaration by Specifying the Size

Arrays can be declared by specifying the size or the number of array elements. The size of the array specifies the maximum number of elements that the array can hold. In the latest version of C, you can either declare an array by simply specifying the size at the time of the declaration or you can provide a user-specified size. The following syntax can be used to declare an array simply by specifying its size.

 

 // declare an array by specifying size in [].

int my_array1[20];

char my_array2[5];

// declare an array by specifying user defined size.

int size = 20;

int my_array3[size];

read less
Comments

Related Questions

What are pointers in C language?
Hi Imran, Hope you are doing good. Are you looking for short answer or long answer? :) Pointers in C are variables that store memory addresses. They point to the location of another variable, allowing...
Imran
0 0
7
What is the best website to learn c language?
In case of problems you will face while making programs, you may take help of google. There may be the situation when you need a helping hand to make clear the basic concepts of programming and internal...
Nom

Program to accept a list of elements and find the maximum number in the list. 

 

The logic will be 1. Create an array of the desired type 2. Sort the array in the descending order 3. Fetch the first elemnet from the array, this will be the maximum element in that array. Now use...
Lavanya
0 0
8
How do I check my C programming skills?
You should try to solve your daily life problems with c , i.e - build your own budget calculator or chess game and many more. Moreover make a habbit of solving 10 questions daily.
Ramnarayanan
0 0
5
What is a local block in C programming?
the statements within the braces { } is known as local block
Rakhi
0 0
6

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Working with C/C++ applications
Inorder to learn C and C++ programming languages one can work with various editors available.To name a few are the most popular one is turbo c++, DEV C++, Eclipse, NetBeans. Here are the screen shots...

C Program-Upper Case Demo
/*WAP to print the character entered by user in upper case*/ //Header files #include<stdio.h>#include<conio.h> //Main function void main(){ char ch; //Function for clearing screen clrscr(); ...

Memory Layout of C Programs
A typical memory representation of C program consists of following sections. Text Segment: A text segment, also known as a code segment or simply as text, is one of the sections of a program in an object...

Can we store different data types in a stack?
Yesterday, one of my Facebook friend asked me this question. My answer is "yes", and in this post I will discuss how could we do this.I am a great supporter of working with unions and I will be using union...

Facts about C language
C programming language was developed in 1972 by Dennis Ritchie at AT&T Bell Labs. It was developed to overcome the problems of languages such as B, BPCL. It was developed to write the Unix operating...

Recommended Articles

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more