Hello everybody,
Years ago I opened the topic linked below about the same thing but at that time I had much less understanding of C and the answers seemed to me enough. Now I want to learn a...
Type: Posts; User: GokhanK
Hello everybody,
Years ago I opened the topic linked below about the same thing but at that time I had much less understanding of C and the answers seemed to me enough. Now I want to learn a...
I have understood what works in functions and what not with more trial and error. For variable declaration, the first of below works with the aid of implicit int rule but the second is not converted...
To be honest I don't think I will use this. The question is mostly because of curiosity and to be able to understand if I see them in an old code.
Thanks for the correction. But what if I don't declare them at all, does implicit int rule makes them int automatically?
Hello All,
My question is about the old implicit int rule. I do not use that one and as far as I know it is encouraged not to use and it is obselete now. However I want to learn it just in case I...
Thanks for your correction, it seems I will need to spend some time with these to gain familiarisation and get used to write my code properly.
@jimblumberg and @laserlight
Thanks a lot for your answers. They did not only clarify things for me but also gave me good keywords to search on Google more. My search took me to C99 draft...
I was thinking I was saying the same thing [I used the name 'a' instead of 'array' by mistake.] The first element of the array is array[0], the value of its address is the same as the adress of...
Hello All,
I have a question about function definitions and calls which accept arrays as their argument.
As far as I see the types of formal parameters and arguments match. For example if I...
Thanks for the replies, I had already added the file to the project but I was assuming I also needed to adress it with including. When I deleted the include line it just saw the file and worked.
...
Hello everyone,
I have learnt a bit C programming but used the language for the case specific small tasks and always implemented all the functions I needed to one file. This time I have decided to...
Thanks for the hint, one more dereference solves the problem. I will think about the logic.
#include <stdio.h>
int main(void){
int array[2][2];
int (*ptr)[2];
ptr=array;
...
My compiler doesn't give me an error and shows a console window but the one below may compile well. However it still doesn't work.
#include <stdio.h>
int main(void){
int array[2][2];
...
I am trying to figure out how pointer arithmetics work on arrays. However I couldn't make an example work.
Firstly I start with a one dimensional array and the example works;
#include...
Thanks for your reply. I was about to ask if example[2] is equivalent to &example[2][0] but you have answered before I even ask. I have learnt much from this forum. Thank you so much.
Great! I was looking for a way to test the type. I use Code::Blocks with GCC GNU Compiler. I will search how can I open warnings.
Thanks for your help.
I have understood much of this. Thanks for your help. I will have some questions about the passing arrays as arguments to functions but before this I want to clarify something.
Do you mean...
Hello Everyone,
There is a lot confusion on internet and some books about the pointers and array names.
I have seen some sources claiming array and &array are the same as array is the name of...
Thanks for both noticing me. Actually I was reading my old notes and I had taken note of this "size_t is defined in typdef library". However I reopened the book I was studying when I took these notes...
Hello everyone
I wonder if it is required to write #include <typedef.h> at the begining of the code to use the sizeof operator according to the standard.
The return type of the sizeof operator...
I have understood it now. I tried with another compiler and it worked. Thank you very much for your explanation.
Then is it normal that it doesn't work?
Hello all,
I am trying to learn the specifiers for the I/O functions. I have read that C99 added %a specifier to read floating-point numbers. However I cannot use it. What can be wrong? The code...
Thanks for your answer but just to make sure I want to show you something I found: "default argument promotion in variadic functions"
Gavin Smith's Blog: Notes on C default argument promotions and...
Thank you very much for your answer. I am OK with the last two examples.
"%d with char (char is automatically promoted to int in expressions therefore it will display the correct value)" Do I need...