Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6548387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:57:58+00:00 2026-05-25T11:57:58+00:00

I was reading a csc placement paper where I read a question related to

  • 0

I was reading a csc placement paper where I read a question related to c language array’s sizeof() operator. Answer was something else then i expected it to be.

int DIMension(int array[]) {
   return sizeof(array )/ sizeof(int);
}

main() {
   int arr[10];
   printf(“Array dimension is %d”, DIMension(arr));
}

This program in c language prints 1 as the answer. Why is that happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:57:59+00:00Added an answer on May 25, 2026 at 11:57 am

    Because int array[] is just a pointer and it’s size is same as of int.
    I think you expected that size of arr will somehow be passed to function, but it doesn’t work that way. Size of arr can be determined only in same scope where it was declared, because sizeof actually works at compile time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading code from other posts, I'm seeing something like this. struct Foo { Foo()
Reading through this question on multi-threaded javascript, I was wondering if there would be
Reading this excellent answer about password hashing and wondering how to implement it: The
Reading this question on importing ColorData from matlab, I was wondering if there is
Reading this question I found this as (note the quotation marks) code to solve
Reading over the responses to this question Disadvantages of Test Driven Development? I got
Reading this fascinating (and highest voted question) on SO, Why is it faster to
reading the SCJP book, I've found something like this in the chapter 1 self-test
Reading some related questions made me think about the theoretical nature of HTML. I'm
Reading this question , I wondered how much time (asymptotically speaking) does it takes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.