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

Computer & Maths Professor

Yes. We can refer to an element beyond array size as C follows the following formula to go to a specific element in an array- starting address of array + sizeof(datatype of array)*subscript of array used. For example, if there is an int (assuming 2 bytes storage space for int) array of size 5 starting...
read more
Yes. We can refer to an element beyond array size as C follows the following formula to go to a specific element in an array- starting address of array + sizeof(datatype of array)*subscript of array used. For example, if there is an int (assuming 2 bytes storage space for int) array of size 5 starting from address say, 100 and the user tries to access a[5], C compiler would move to 100+2*5 i.e. address 110 irrespective of the subscript number as array elements are stored continuously in memory. read less
Comments

COMPUTER GEEK

No for an array you can not go beyond the size of array as you may be entering into restricted area and may result in segmentation fault. Only C99 allows to have the size of address at runtime
Comments

C and linux Expert

It's valid to address it, but not to see what's there.
Comments

LearnHowToLearn, Expert In Programming Languages

No. It is invalid even if there won't be any compilation error. Accessing elements beyond array size is illegal memory access may cause segmentation fault runtime.
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

VKTechnology

no. outof bound array exception occurs
Comments

website and mobile application development training, digital marketing training

No
Comments

GeeksForGeeks

C language do not perform any bounds check on array during run time, so it will not give any error if you are doing so. But technically its not right to do so, because the memory location you are using or manipulating anything may contain some very sensitive information, which may other program are...
read more
C language do not perform any bounds check on array during run time, so it will not give any error if you are doing so. But technically its not right to do so, because the memory location you are using or manipulating anything may contain some very sensitive information, which may other program are using, can lead to crash the program or machine itself.. read less
Comments

View 18 more Answers

Related Questions

The object file is in binary code, and the machine understands the binary language. So why object files are not executed?
Object files are sources compiled into binary machine language, but they do not have library files, so they are not executed.
Dhruvil
0 0
9
Is it good practicing c++ in code blocks instead of turbo c++?
Practicing/working on Turbo C++ is always good..because its hard to do comparatively 'code blocks'. seems 'code blocks' has been designed by considering the latest working tools(like Visual Studio from...
Santosh
What will the pre-processor do for a program?
The pre processor takes a look at your source code just before it goes off to the compiler, does a little formatting, and carries out any instructions you have given it. Each # command that the preprocessor...
Neel
0 0
6
What is a pragma?
In computer programming, a directive pragma is a language construct that specifies how a compiler should process its input. The ' #pragma ' directive is the method specified by the C standard for providing...
Anil
Is c language easy to learn?
The ease of learning C language depends on your prior programming experience and familiarity with certain concepts. For beginners, C can be challenging due to its syntax and manual memory management. However,...
Vikash
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

Recursion in C Programming
The process of calling a function by itself is called recursion and the function which calls itself is called recursive function. Syntax of Recursive Function returntype recursive_func () { statements; ...
R

Ravindra Yadav

2 0
0

Why we need to learn Programming languages?
Language is medium for communication. If two parties like to communicate or exchange the thoughts they must know a language. Language should be understandable by both the Parties. For example A wants to...

Design your own Mouse Driver in C Language
Mouse Driver (msdrv.h) #include #include union REGS i,o; restrictmouseptr(int x1, int y1, int x2, int y2) { i.x.ax=7; i.x.cx=x1; i.x.dx=x2; ...

Some Tricky Questions in C
Can you write two functions in which one executes before main function and other executes after the main function? #pragma startup #pragma exit Where, priority is optional integer value.For user priority...

Programming Practice Technique
Any Programming Language required an Algorithm. Algorithm - It is the finite set of instructions in which each and every instruction has the meaning, instructions are not ambiguous and all the instructions...

Recommended Articles

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 >

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 >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

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