nitin1 15 Master Poster

sir, it is teaching me pointers to pointers which i am well aware of. i got the point that void * is undisclosed data type pointer , that's why it is okay to do, but void ** is disclosed data type pointer as it is pointing to a pointer (which is specified). it is okay! i got it. can i related this thing to const thing also ?

nitin1 15 Master Poster

firstly what was "yeah...no", means partial right , partial wrong ?

secodnly, i got it what u told me. but why generality doesn't work at that level ? i mean in case int**p , but not in case of int* ? i didn't get this point only. thanks.

P.S awesome example, i have noted it down.

nitin1 15 Master Poster

like when i have int p , nothing is int and when i have char *p, nothing is char and when i have void means it is a pointer which is not pointing to any specific data type. and it is used just for using for functions like malloc which need to allocate memory for any type of data type pointers. for ex: void * g; it mean g is pointer to some unknown data type.

P.S (don't know why * are not there even if i am writing them !)

nitin1 15 Master Poster
void *

is a pointer to nothing , and void ** is a pointer which is pointer to pointer which points to nothing. I wish i am correct.

nitin1 15 Master Poster

ohh.. that means getting a[3][4], by giving a[0][0] is just theortical and it is not true for compiler to get address like this ? am i right ?

nitin1 15 Master Poster

yeah, firstly. but after asked by you , i compiled as .c and it is giving me warning now. not error. can you explain these things sir ?

nitin1 15 Master Poster

then why we study about row major and column order ? then how are we able calculate the adress of a[3][4] given the address of a[0][0] ?

nitin1 15 Master Poster

code 1:

void fun(const int **);

    int main()
    {
          int **p;

          fun(p);
    }

code 2:

void fun(const int **);

    int main()
    {
          const int **p;

          fun(p);
    }

code 1 is compile error and 2 is not. can you explain why ? as per my knowledge, we can convert a non-const to const but we cant change const to non-const. and even to prove this, when i repace the above with "pointer to int" and everything remain same, then it works. then what is hidden in double pointer conversion fron int ** to const int **. thanks in advance.

nitin1 15 Master Poster

can i have any idea on this ? anyone ? thanks

nitin1 15 Master Poster

ohh... but that is when i will dynamically allocate that. sir, how are arrays stored in memory ? row-majored or column majored ? can i do with the help of this thing ? thanks.

nitin1 15 Master Poster

yoo sir! thanks alot. here i wana ask 1 more problem is that if you have 2-D matrix and you want to write a general method for displaying them, then how can i make it ? and i want to pass the 2-D matrix in the function.

display(int a[][],int m,int n);

so m,n is the dimensions and i wondering that i have to pass one dimesnsion in the a[][], and i do that then it will not be genral. so how can i do that ? thanks. i tried some ways , but was not able to do that. thanks.

nitin1 15 Master Poster

that's okay if it is unneccassry. here point is not about if it is useful or not, but is it perfect ? I mean is there any error or undefined bahviour in this ? because i will getthis question to tell "do you find any ERROR in this ? ". thanks alot sir.

nitin1 15 Master Poster

yoo! very nice explaination sir. take a bow. but sir, i think &"hello" in the first case can be correct ? because i can do this :

printf("%p %s\n", (void*)&"hello", "hello");

isn't this okay ?

nitin1 15 Master Poster
int main()
{
     printf("%u %s",&"hello",&"hello");
     return 0;
}

can you please explain that how "hello" is working here ? i know it is string constant ? so it is acting as a pointer to a char like i do

char *s= "daniweb"; 

so, if it is the case, then why do i need & to find it's address ? I am little bit confused. Can you explain the output if i don't write & with both "hello" ? thanks in advance.

nitin1 15 Master Poster

yoo! nice... and one thing, this thing always improves one's confidence. when u say something which you know you are damn correct and sure about that thing, and you are able to prove that you are correct, next time you will hit that with double confidence. i know this thing, but never able to implement this. :( sorry to myself.

nitin1 15 Master Poster

i really really appreciate your extent of confidence. because many times i know i am 101% correct, but still i say "am in doubt" because person in front of me is saying this again and again. i have seen that you don;t come under this category.

nitin1 15 Master Poster

statements of you and James sir are little bit contradictory. i can't offsense any one of you. can you please clearify this ? thanks alot.

nitin1 15 Master Poster

ohh... ok , i will grasp it as standard says. but like this (pointers to functions), what else i need to typedef like this ?

nitin1 15 Master Poster

yeah sir. that's what i am saying. that it is not problem for float and all, but it is problem for pointer to functions. can you explain why it is so and what are the other exceptions to this ? thanks a lot sir.

nitin1 15 Master Poster

no no sir(s)! the place from where i have read , it says you can use it for int,float,double. char*, float* etc, but they have given an example in which they have used this statement given above and saying that this is not way to extract a pointer to a function. they have firstky typedef it and then extracting the pointer to the function. they are saying this thing specifically for pointer to functions. (I don't know if there is any exception like this for something else also). now tell the solution.

nitin1 15 Master Poster
va_arg (ap,int(*)()) 

here, ap is the va_list type variable and it is started with va_start() already.

the place where i have read this said that this is wrong and you have to typedef it first , then you can extract the pointer to a function from the va_arg(). why is it so ? if i can extract int,char* this way, then why can't i do this ? thanks.

nitin1 15 Master Poster

A man in need is a friend indeed.... :-)

nitin1 15 Master Poster

yes! sorry for that. yes i am intending to do that only which you have wriiten in last line. hete it goes :

#include<stdio.h>
main()
{
int a=258;
int *num=&a;
printf("%d %d",*((char *)num),*(((char *)num)+1));
}

now, can you answer my questions which was asked ? thanks alot.

nitin1 15 Master Poster

no , i haven't tested on both types of systems. but will the ouptput differ if i run this code on different machines ? that mean i will get highest bits firstly on big-endian and lowest bits firstly on little endian ? right ?

nitin1 15 Master Poster

Wouldn't it be nice if we have a notification system ? I mean i will get notifications of only those threads on which i have replied at least once or the threads which are started by me ? It is going to help me alot if i have a beep sound whenever i have a notification like fb system has. because when DAniweb is opened on another tab, i have to refresh it so as to check any reply or something. Aslo, it will notify me whenever i am working on something else and i have a beep sound which will tell me that i have a reply. Don't know how much useful it is, but it is damn helful to me and i hope will be helful to others also. (we may have an option to switch off the notifications so as to save people who don't want this feature). thanks a lot. :-)

nitin1 15 Master Poster
#include<stdio.h>

main()

{
int a=258;
int *num=&a;
printf("%d %d",*((char *)num),*((char *)num+1));


}

does the output depends on little endian or big endian structure of machine on which i am running this ? thanks.

nitin1 15 Master Poster

ohh... these are warning. but not errors i suppose. so @iamthewee what will you say about the codes now ? and why are using switches to compile the codes ? thanks.

nitin1 15 Master Poster

so what is the answer now ? but have u seen the link which i have given ? it is showing no error. reson may be that u are using .cpp file and i am using .c file. (i am not sure though). then what is the correct and exact answer for the question if you are not goven anything except that code snippet ? thanks.

nitin1 15 Master Poster

sir, i have changed the question right now, please look at the change as i was editing when you have answered. thanks. sorry for that! o/p is 1,3 respectively and no warning at all. here is the proof. Click Here thanks

nitin1 15 Master Poster

code 1:

#include<stdio.h>
int main(void)
{
int a;
a= 1,2,3;
int b = a++;
printf("%d",b);
return 0;
}

code 2 :

#include<stdio.h>
int main(void)
{
int a;
a= (1,2,3);
int b = a++;
printf("%d",b);
return 0;
}

Can you please explain why that bracket is making ouput changed ? i know comma operator wrokd from left to right. but why that thing is not working for first case ? thanks alot in advance.

what i am thinking is that = has more precedence than comma. so it is attached to that more tightly. but then is it looking like this.

((((a=1),2),3));

so after assigning them, why 2,3 is acceptable to compiler ? why is it nor giving error ? thanks.

nitin1 15 Master Poster

that's really cool! if this feature is included in the daniweb, then surely it is going to be far far far and far better than any other CS forumn in google.com. :)

nitin1 15 Master Poster

and how (0.25) in decimal is equal to (1.0)2^ (-2). shouldn't it be (1.0)2^(-1) ?

as per their method,

0.25 *2= 0.5  (0)
0.5 * 2 =1.00 (1)

so 0.25 = (10), but in IEEE format, it is shifted and it is looking like this, (1.0)*(2^-1) as it is shifted one right shift ? why is it (-2) ? please explain this thing. thanks in advance.

nitin1 15 Master Poster

can ypu explain a little bit ? i have already read it before your post, and again read it after your post. can you explain how 7 digits come in precision part ? that log part , can you explain ?

secondly, what is significance of that exponent bias ? please explain little bit. i have read 3-4 articles on that. thanks a lot in advance.

nitin1 15 Master Poster

i know how numerical values are represented in memory. like +3, -3, 0, 1 , 3321 and like this. can you tell me how float, double are represented in memory ? like 3.220, -9876.87 ? i mean how bits are presented in memory ? like for singed number 32th bit is 1(from left to right). so can you please throw some light on this thing that how number before decimal and after decimal is represnted in float and double data type ? thanks a lot. :-)

nitin1 15 Master Poster

and what about tutorial part ? :-) thanks for so many thanks :D

nitin1 15 Master Poster

when i was using the daniweb before that change, it was nice. but when you have changed that, it was even more nice, but took some time to me to get used to with it.

secondly, i dn't know why people are not posting the questions or replies. changing platform can't be the reason according to me. if i am nitin, i have doubt, if it is getting solved , then i dont have any kind of problem with daniweb and it's platform. The day when i will not get my solutions, i will loose interest. so platform as an user has no issues. i have introduced daniweb in my college to my juniors which are around 200 in number and everybody is using it to full extent.

thridly, one thing which i don't feel good is the pop-up which comes my way when i post the new thread(still not a major issue). and one need which i feel as a user on daniweb is to have spell-check. other mathematics forums have this thing, and make me much easier to write there when discussion go so long. that's set!!

@dani and all truly saying with core of heart, whatever disaster comes, whatever platform is changed, whatever hell happens, but the quality of people and gold of knowledge and experience which people here has, will never allow daniweb to go down. :-) true it is!! And if i say something about tutorials, then i have already said this thing to James …

nitin1 15 Master Poster

firstly, the 2 things i am talking about are undefined and implementaion dependent. can you explain it with one more example like above ?

secondly, what is meant by "document it" ? this is the key to understand difference between unspecified and implementation dependent. thanks alot.

P.S I don't know i am capable to say you this , but people like you can be placed any where you want. but seriously, it is very good to see something which you are not able to answer correctly. :p (joking) hehe

nitin1 15 Master Poster

yes! sometimes it doesn't show pictues, comments. everything keep running fine for me, but sometimes daniweb behave very slow, i dont know why. sometimes, it is slow when i need to swap from C to C++ or any other place.

nitin1 15 Master Poster

I will tell u my journey. arranged from first book i have read till the last book i read from top to bottom.

  1. sumita arora , C++
  2. Yashwant kantekkar , C basics
  3. C, Balagurusamy
  4. dennis Ricthie, C
  5. test ur C skills,, C & C++ both
  6. at last, currently reading tanenbaum ,C .

good luck!!

nitin1 15 Master Poster

@deceptikon sir, you and that too in an interview ? :-o what is the result now ? yoo! am damn excited to know. ^_^.

sir, i wana clearify that undefined and implementaion dependent, both are not defined by C standard ?

secondly, i have read somewhere that malloc may use sbrk() in which when we pass 0, it returns pointer to location at which current heap is there. can't we relate this to that ?

thirdly, can you please give one more example to exemplify the difference between these 2 things ? thanks.

P.S best of luck sir!!

nitin1 15 Master Poster

@diafol it's not defcon 3.. i will be defcon 1.. hahahha... :p (joking).. :D

nitin1 15 Master Poster

@iamthwee I don't know what u r talking about. :p your comment includes monkey, gay, humans, SD development, daniweb, truth , lie. hahaa. It will be good if you take care of yourself. :-p seriously, you are truly insane. i truly enjoy your posts which genuinly shows your anger. you don't have manners to talk(for which your ancients are responsible) , you dont have good post quality (for which you yourself and your knowldge is responsible), you dont know what to say and when to say(for ex: this post). so don' u think you have to change yourself completely ? :-p just go away from this thread and spend this time on yourself. :-) good luck dude/(female version of dude) as i don't know ur gender. :-p hahha.. relax and go to work. it's 11am. wake up!!
:-)

huhh...

happygeek commented: erm, you just agreed with diafol that any further comment was only going to provocation and then... you add further provocative comment. I give up... +0
nitin1 15 Master Poster

@ezzaral, okay! thanks for your valuable comment. should we leave this thread now ? or should we explore more about my behaviour and other things on a software development forumn ? what do you actually want ?

here, people are full of knowledge , but also know how to irritate and mock at someone to the full extent. from where and for what purpose i have started the thread and just look at this thread, where it has turned over at the end ?

I request you all that it is a SD forumn and we must maintain it as it is. I truly dont know what is relation between things related to my behaviour and this thread. answer must be yes or no, that's set!!! whether i can get it back or not, answer must be yes or no or some with reasons liek happygeek and all have given nicely. no one can do anything if you take ice-cream with Tea!! thanks alot.

nitin1 15 Master Poster

I know answers for approximately 80% of the problems above. but it will be against rules if i help u without watching your effort in this. thanks. :-)

somjit{} commented: 80% ? hmm.... +0
nitin1 15 Master Poster

I know it was your mistake, i didn't point out it because i want you to judge yourself because i am too small to judge you. i am small in age, experience and ettiqutes also. thanks to you that you admit your mistake. thanks diafol sir. :-)

Ezzaral commented: Whatever. You're just being a twit. +0
nitin1 15 Master Poster

what about in .c file ? you have considered the case when it is cpp , when it is C then ? is it still compile time operator ? or there is any exception with this also ? thanks.

nitin1 15 Master Poster

so, in C++ if i have this code and it is not written anything else about compiler extensions, then what would i say about this code in front of me ? it's very very good explaination which you have given, but all these are when i know about extensions and all. it is a question which will be asked to me in a MCQ type problem, so can you please tell me this ? thanks a lot.

nitin1 15 Master Poster

say say whatever you want. i don't have any feelings now. bbbbbbbbbbyyyyyyyeee.. :-)

nitin1 15 Master Poster
#include<stdio.h>
void f(int n)
{
    char pp[n];
    printf("%d\n",sizeof(pp));
}
int main()
{
    int n;
    scanf("%d",&n);
    f(n);   
}

In this program the size of array is defined at runtime,and sizeof operator is printing correct size after runtime initialisation in gcc 4.4. Can anybody explain? we say that sizeof is compile time operator.then ? and C99 give us to have this type of initaliazation. pp[n], it is dynamic.but it is still working ? (above snippet is working correctly in .cpp and .c both correcttly.) thanks alot.

nitin1 15 Master Poster

@banfa firstly, example you have given is of many millions! made me clear of many many doubts.

one thing, you said that order of evaluation doesnt matter. but till the time last expression is not in our hand, till that time order of evalution will matter ? for ex: c*d / , in his case you have parethsized the expression. this mean that it is important to do so otherwise we may get wrong results ? right ?

until we dont have unambigious parenthisezied expression, we take order of evaluation ? I mean oder of evaluation comes into picture when it is done with the parenthazation ? am i right ? and we must take care in case of only 2 operators (&& , ||) right ? make me correct .thanks.