UrbanPro

Learn C Language from the Best Tutors

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

Search in

Is it valid to address one element beyond the end of an array?

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

C Language Trainer

No, array is a fixed size memory allocation for variables. It is illegal to access elements beyond the allocated space.
Comments

Thank You for the question Shivani, No for an array you cannot go beyond the size of an array. Thanks, Team DishaaPro www.dishaapro.com
Comments

Not a great idea, you will be accessing memory which doesn't belong to you or your array, may be used by some other variable with some other meaning/view.
Comments

Engineering Computer science subjects like C, C++, ADA

No, Never a developer allocate a string within its memory space.
Comments

Computer Programming Expert and Software Developer

It is purely compiler dependent. It means, some compiler also can take more than one values beyond the end element of the array.
Comments

Experienced software professional, interested in teaching

Logically, it doesn't make sense. In practice, you can do this and still get away without CORE being dumped. For example, you defined an array of 10 ints and a single int variable. In most of the compilers, memory is allocated continuously. So, when you refer 11th element of the array as , you are...
read more
Logically, it doesn't make sense. In practice, you can do this and still get away without CORE being dumped. For example, you defined an array of 10 ints and a single int variable. In most of the compilers, memory is allocated continuously. So, when you refer 11th element of the array as [10], you are actually pointing to the next memory location, that is the single int variable, but also belongs to your program. In fact, using array index to access individual array elements is nothing but array arithmetic, with array name being a pointer to the beginning of the array memory locations read less
Comments

Senior Software Engineer

no
Comments

Programming Trainer

It's not applicable, if the array has a predefined size. Although it's applicable if using pointer method of array definition, nut still you'll have to allocate memory dynamically before using that index of the array.
Comments

VKTechnology

no. outof bound array exception occurs
Comments

No, it will give stack overflow and run time error
Comments

View 18 more Answers

Related Questions

What are important topics in C language?
Variables and handling datatypes · Structures · Functions · Pointers · Arrays · Conditional statements and switches · File handling · System
Everest
0 0
5
What is the best way to comment out a section of code that contains comments?
you can use /* multiple line comments */ and // for single line comments
Prasad
Can an array be an lvalue?
When you say array, do you mean array name i.e. address, or array element. Yes, array element can be lvalue
Vinodha
Do array subscripts always start with zero?
It purely depends on the programming language. C, C#, Java all provide array indices starting from zero (0). COBOL, FORTRAN, ALGOL etc. languages provide array indices starting from 1.
Avishkar
Who created C?
C programming language was created by Dennis Ritchie at Bell Labs in the early 1970s. Along with Ken Thompson, Ritchie developed C as an evolution of the B programming language, aiming to provide a more...
Srinivasan
0 0
8

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

Ask a Question

Related Lessons

C-Program Swapping Contents Of Variables Using Function [Call By Reference Method]
//Header Files #include#include // User defined functions swap with 2 pointer variables passed as an argument list void swap(int*i,int*j){ // Local variable temp int temp; // swapping contents using...

What Would Be Life Cycle Of A Fresher After Campus In An IT Company?
1. Basic Technical Training: Since freshers are not subject matter experts so gone through 3 - 6 months basic technical training within Organization. 2. Technical Assessment: HR sends freshers to various...


Some interview questions and answers for fresher level on Pointers
What is a void pointer? Void pointer is a special type of pointer which can reference or point to any data type. This is why it is also called as Generic Pointer. As a void pointer can point to...

Software Development Training In Jaipur
Satyam Web Solution provides website designing &development and software designing &development training in Jaipur for various stream’s students. MCA 6 month Industrial Training/Internship B....

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