All you have to do is this
Code:unsigned int umax = -1;
That will work on nearly every machine you ever use, but it wouldn't work on a system that represents the signed integer -1 as anything other than all 1s. The representation of signed numbers isn't defined in C.
That will work on nearly every machine you ever use, but it wouldn't work on a system that represents the signed integer -1 as anything other than all 1s. The representation of signed numbers isn't defined in C.
does anybody publish a printed version of the OpenGL 4.5 reference manual? I'm going to be going through an extended period without internet at home due to a house fire and I need to refer to the reference manual quite a bit. I have a super old version of the reference manual from 1995 for release 1, but it's changed considerably. Typically, I'll just pull up the man pages but that won't be an option short term.
I've been looking online - I can find plenty of books that walk you through openGL but nothing that is a straight up reference manual. Any idea if such a book has been published?
So posted this in the web design thread but didn't get any responses so I'll try here.
There's a web design thread
------
Advice wise, there's only two things.
Keep learning. Every. Single. Day. It doesn't matter what it is, as long as it's something you didn't know yesterday.
Build things. Aim for a website a week. Even if it's just some dorky site that plays Hiyayayayayayaya on repeat for 24 hours a day. You'll be solving problems and getting experience building things.
Once you start to feel more comfortable with Javascript and HTML/CSS start to look into the various tools and frameworks that exist for those languages, (there are thousands). The big ones being:
I'm probably missing some, but I'm braindead from calc. Start with jQuery though if you are looking to learn more about intermediate/advanced Javascript.
- jQuery
- Bootstrap / Foundation
- SASS/LESS
- AngularJS / ReactJS / EmberJS
- NodeJS
I wouldn't call it strictly better, it doesn't have functors for example.Not sure id call OCaml more powerful than Haskell, but if you like OCaml, then definitely try F#. It's a much better version of OCaml
#include<stdio.h>
int main(int argc, char *argv[])
{
char *names[]={"name1", "name2", "name3", "name4"};
printf("%s\n",names);
return 0;
}
Yes, for loop.
I tried an array with integer elements and printf didn't work either. so printf requires you to specify the index of the elements?
char *names[] = {"name1", "name2", "name3"};
int i;
for (i=0; i < 3; i++)
printf("%s\n", names[i]);
Something like this:
Code:char *names[] = {"name1", "name2", "name3"}; int i; for (i=0; i < 3; i++) printf("%s\n", names[i]);
char name[] ="Apple";
char *name1 = "Orange";
printf("%s %s\n", name, name1);
thanks for the reply.
I got the solution to it.
I was confused because I could print both of the following examples
but I think for an array of string elements or any other variable type you have to printf refers to the index.Code:char name[] ="Apple"; char *name1 = "Orange"; printf("%s %s\n", name, name1);
thanks for the reply.
I got the solution to it.
I was confused because I could print both of the following examples
but I think for an array of string elements or any other variable type you have to make sure printf refers to the index.Code:char name[] ="Apple"; char *name1 = "Orange"; printf("%s %s\n", name, name1);
the pointer to the head of an array and the first element are the same. So name[1] and name with both point to "Apple" which is why that worked out.
This is not correct.
name[1] is not only the second element in the name[] array, but it is a character ('p), not a char*.
the pointer to the head of an array and the first element are the same. So name[1] and name with both point to "Apple" which is why that worked out.
I think you meant name and &name[0] are the same
name[x] is just syntactic sugar for *(name+x)
I tried an array with integer elements and printf didn't work either. so printf requires you to specify the index of the elements?
Do you understand why it is not possible to pass an array of integers to printf? Because it illustrates an important lesson about C programming.
oh, okI think tokkun means more along the lines of "arrays are a fictional concept in C, unlike in other languages, they're simply a series of pointers".
Speaking of C, I've started to like it a lot more after I did our memory management exercise a while ago. There's something to doing things at such a low level and with that much freedom, when you code according to how you think things really work underneath the surface and it ends up doing its job perfectly.
Doubt I'll ever use it if given a choice but as an exercise it was fun.
I think tokkun means more along the lines of "arrays are a fictional concept in C, unlike in other languages, they're simply a series of pointers".
Wouldn't you still need to use a for loop specifying the index to print arrays in other languages like Java and C#?
Wouldn't you still need to use a for loop specifying the index to print arrays in other languages like Java and C#?
What is a good OS to code on? I don't have a Mac, so I either have Windows 8.1 or some version of Linux.
If Linux, which one? There are so many. I'm looking for ease of use and little frustrations.
The one you're most comfortable using. Ubuntu is the easiest distro to get into and Linux is a great place to learn to program so I'd tip my hat to that direction.
I've heard of Elementary and Linux Mint. Are there better alternatives?
I have a very high end desktop.
http://pcpartpicker.com/p/jNyhTW
What is a good OS to code on? I don't have a Mac, so I either have Windows 8.1 or some version of Linux.
If Linux, which one? There are so many. I'm looking for ease of use and little frustrations.
What is a good OS to code on? I don't have a Mac, so I either have Windows 8.1 or some version of Linux.
If Linux, which one? There are so many. I'm looking for ease of use and little frustrations.
What is a good OS to code on? I don't have a Mac, so I either have Windows 8.1 or some version of Linux.
If Linux, which one? There are so many. I'm looking for ease of use and little frustrations.
What is a good OS to code on? I don't have a Mac, so I either have Windows 8.1 or some version of Linux.
If Linux, which one? There are so many. I'm looking for ease of use and little frustrations.
Since you specifically are looking for ease of use and little frustrations, I would choose Windows without a moment of hesitation, and I would question any other choice.
memory management is paramount?
const int foo[] = {1, 2, 3, 4, 5};
Name Value Type
foo 0x011f6ae4 const int[5]
| foo[0] | foo[1] | foo[2] | foo[3] | foo[4] |
0x011F6AE4 |01 00 00 00|02 00 00 00|03 00 00 00|04 00 00 00|05 00 00 00|00 00 00 00 00 00 00 00 00 .............................
printf("%d", foo);
printf("%d", 18836196); // This is 0x011F6AE4 converted to decimal.
printf("18836196");
int value = 18836196;
printf("%d", value);
printf("%d", 1);
printf("%d", foo[0]);
I'd agree, with the exception being C coding.
Strange, because I was going to primarily recommend it for C and C++, with not as strong of a recommendation for other languages like Java, Python, etc.
Why do you consider C as the exception? Visual C++ is free, installs with 0 understanding of a command shell, and will get someone up and running faster than any other platform. And the debugger is better than anything else on any platform too.
I think it's because of C's history being written as the language for Unix, and unix being the OS for C. I'm certainly partial to GCC and posix compliance. Used to the gcc libs, the man pages and gdb.
I've used things like CCS on windows to write embedded C, really handing for looking at and manipulating memory in real time. So I see the value of a full development environment. But I feel linux allows me to pull away the abstraction further, and work closer to the OS and the hardware.
But I've only used mingw in windows, so that is also where I'm coming from. I think I'll try out Visual C++ on your recommendation now. But I'm glad I've at least developed foundations in a linux environment.
Ok, I'm trying to use the rename() function in C to move a file from a directory to the /tmp directory, but it keeps failing. It'll work in /home, /Treechopper, /Documents, but not /tmp. What do I not understand?
is there some sticky permission bit set?
Standard /tmp directory. drwxrwxrwt