• Why isn't my image appearing in the browser? HTML5?

    This is the code I have so far: <!DOCTYPE html> <html> <head> <title> An Original </title> </head> <body> <p>This is my very first website.</p> <p> I'm going to try and insert an image into my code. I hope it works.</p> <img... show more
    This is the code I have so far: <!DOCTYPE html> <html> <head> <title> An Original </title> </head> <body> <p>This is my very first website.</p> <p> I'm going to try and insert an image into my code. I hope it works.</p> <img src="swimming.jpg" width="640" height="433"/> </body> </html> I have index.html in the same folder as the image.
    8 answers · 4 days ago
  • What interesting things can you actually do with C programming language that doesn't involve using microcontrollers/arduino/etc?

    When you read a programming book on C, most of the things you learn in a beginner's book don't seem very applicable to anything useful. Cool, you learn how to use pointers, structs, and arrays and loops and data structures and algorithms. Big deal, what can you actually do with this? When you learn web... show more
    When you read a programming book on C, most of the things you learn in a beginner's book don't seem very applicable to anything useful. Cool, you learn how to use pointers, structs, and arrays and loops and data structures and algorithms. Big deal, what can you actually do with this? When you learn web development, you actually learn how to MAKE a web application. With C, it seems they just teach you a bunch of random disjointed topics that aren't applicable to anything useful as the end goal.
    6 answers · 1 day ago
  • Domain name with one company, hosting with another?

    Best answer: Sure you can, that is what the DNS is for. Go to your domain company and point your DNS pointer to the DNS system given by the hosting company. Most of the internet runs this way, very sites run on the same as the domain name (my personal one does only because its a small site - more typical for people who have a... show more
    Best answer: Sure you can, that is what the DNS is for. Go to your domain company and point your DNS pointer to the DNS system given by the hosting company. Most of the internet runs this way, very sites run on the same as the domain name (my personal one does only because its a small site - more typical for people who have a domain in their own name) where as at work we all our domain names with one company and our servers somewhere else.
    5 answers · 14 hours ago
  • What should I do after learning Java?

    8 answers · 3 days ago
  • Should I capitalize case sensitive Java functions if they start a sentence?

    Best answer: If you are using a word processor, you can do things with formatting. In a forum like this that only uses plain text, you can do things like this: ==================================================== There are many things in Java like this for (int i=0; i<5; i++) which you can use as... show more
    Best answer: If you are using a word processor, you can do things with formatting.

    In a forum like this that only uses plain text, you can do things like this:

    =======================================...
    There are many things in Java like this
    for (int i=0; i<5; i++)

    which you can use as needed.
    =======================================...

    In other words, come up with an introductory phrase, and then have the Java statement on a separate line.

    I like to leave a blank line after the Java statement, and then continue the main sentence after that.
    4 answers · 6 hours ago
  • Is there a web builder/creation software out there which allows me to code my own stuff too?

    I am trying to create a website at the moment but all the website creation options seems to keep relaying the same message of "No coding experience needed" and that its as easy as dragging and dropping, but that limits the functionality the website will have, I am an experienced coded and would like the... show more
    I am trying to create a website at the moment but all the website creation options seems to keep relaying the same message of "No coding experience needed" and that its as easy as dragging and dropping, but that limits the functionality the website will have, I am an experienced coded and would like the drag and drop option but would also like the option to code my own stuff on the website, is there any software or companies which allow me to do both?
    5 answers · 2 days ago
  • Can anyone tell me what&#039;s wrong with this program? Visual Basic?

    Can anyone tell me what's wrong with this program? Visual Basic?

    Best answer: Well, first we don't know what it's supposed to do. Second, the photo is too fuzzy to read. You have at least one Exit Loop that seems to go to an Input statement rather than exiting the loop. I don't know what your teacher's rules are for showing an Exit Loop in a flowchart but I wouldn't... show more
    Best answer: Well, first we don't know what it's supposed to do.

    Second, the photo is too fuzzy to read.

    You have at least one Exit Loop that seems to go to an Input statement rather than exiting the loop.

    I don't know what your teacher's rules are for showing an Exit Loop in a flowchart but I wouldn't have it go back up to the loop statement. I'd have it go to the arrow out of the loop statement.
    4 answers · 1 day ago
  • I want to graduate as a graphic designer but some family members say the market is too flooded, I wont get a good job is this true?

    Best answer: Don't let them stop you from doing what you want to do! There will always be a need for graphic design.
    Best answer: Don't let them stop you from doing what you want to do! There will always be a need for graphic design.
    21 answers · 1 week ago
  • What is the actual point in using pointers?

    Best answer: 1) Pointers ARE NOT used to allocate memory. You are confusing 2 different questions: heap vs stack memory, and data types. A pointer is, technically, an address and nothing else (and from a language point of view it is a pair address/type) If you does this: int v; int *a=&v; a is a pointer. Yet, you've... show more
    Best answer: 1) Pointers ARE NOT used to allocate memory.
    You are confusing 2 different questions: heap vs stack memory, and data types.

    A pointer is, technically, an address and nothing else (and from a language point of view it is a pair address/type)

    If you does this:
    int v;
    int *a=&v;
    a is a pointer. Yet, you've not used to allocate memory. The value v is a value (in the stack; that is a local variable, allocated by the compiler). a is a pointer, that is also a value in the stack, but this value is to be understood as an address of some place in the memory. After I type a=&v, a is the address where v is stored (a is the address in the stack where the compiler decided to store v)

    2) Your code is not working
    You CANNOT type
    char *a;
    a='h';

    a is supposed to be the address of a variable. That is, a 32 bits integer, or even a 64 bits integer, on most machines.
    And what you are trying to store in it is a char (a 8 bits integer, usually representing an ASCII code)

    The only reason why it may compile in with some compiler (with certainly a warning) is because 8 is smaller than 32 or 64. So the is room to store 104 ('h' is another name of 104) in a variable that is supposed to contain a 32/64 bits address.

    But you could have then, as well, typed
    char *a;
    a=1234;
    it would make exactly as many sense (you store an int, 1234, in a variable declared as an address. Sure if you insist on doing it, with a warning, the compiler can do it, since, after all, an address is a sort of int. But that makes no sense.
    If you try afterward to use variable a as a pointer, for example by derefencing it, you will get a segmentation fault.
    For example, if you try to
    printf("%c\n", *a);
    as you should be able to do if a were a valid pointer, it will try to print the "char" stored at address 1234 of the memory (or at address 104 is a='h'), and chances are that those address do not belong to your process, so you get a segmentation fault (if you are very lucky, or, I should say, very unlucky, those address 1234 or 104 belong to your process, and you won't get a segmentation fault. But you code will do some BS, since, obviously printing the content of address 1234 or 104 was not at all your intention)


    3) The correct version of your code would rather be
    char *a;
    ...
    *a='h';
    (a is the address of a char. Hence *a is that char pointed by a. So you can change the value stored at address a by modifying *a)

    Without anything in place of the "...", though, that would also lead to a segmentation fault.
    Because, as all variables, its initial value is not specified.
    When you declare
    int v;
    v could have any random value, before you initiazed it with a value (a number) that makes sense.

    Likewise, when you declare
    char *a;
    a could have any random value before you initialize it with a value (an address) that makes sense.
    So if you try to read or write content of *a, you are trying to read or write the content of a random place (even maybe a non existing place) of the memory. That can't end well.

    So for example you could do this:
    char *a;
    char v='h';
    a=&v:
    *a='x";

    a is a variable of type "address of a char".
    v is a variable of type "char", whose value is 'h' (that is 104)
    a value (which was a random uninitialized value) is changed to the address of v.
    So, now, address of v is a. And its content is *a (hence *a is 'h')
    Then after the execution of
    *a='x'
    value stored at address a is change to 'x'.
    Since a is the address of v, that means that value of v has changed to 'x'.

    Of course, this has no interest at all (see later of interest). But that is how you use pointer.


    4) Another thing you could have in place of my "..." is a memory allocation
    char *a;
    a=malloc(1);
    *a='x';

    That is probably what you are referring to when saying "you need them to allocate memory". Because if you want to allocale memory in the heap, with malloc, then, since malloc return a pointer, you have no choice but using pointers to access this memory.
    There is no variable whose content is 'x' in this code. The only way to read (or replace) that 'x' is to access to *a


    So summary of all these 4 points: you have 2 questions here
    1) Why to I need pointers
    2) Why to I need "malloc" (or new in C++)

    5) For pointers, you need them whenever you want to give an address
    For example, if you want to write a function sqr, to compute the square of a number. You have two choices

    You could write
    int sqr(int x){
    return x*x;
    }
    So the square is computed, returned, and the caller may store the returned value in a variable itself, like this:
    int y=sqr(x);

    Or, you could, instead of using return values, say to function sqr : compute the square of this number (x) and store your self the result at this address (adr)
    void sqr(int x, int *y){
    *y=x*x:
    }

    So the caller does not store itself the result in a variable. Instead it gives sqr the address of a place where sqr is supposed to store the result. Like this:
    int y;
    sqr(x, &y);


    If you create a function whose results are two different values, that is pretty much your only choice. For example, if you want to compute both square and cube of a number. You could do this:
    int sqr(int x){
    return x*x;
    }
    int cube(int x){
    return x*x*x;
    }
    int a,b;
    a=sqr(x);
    b=cube(x);
    And use both. But that means that cube will compute x*x (x*x*x means (x*x)*x) that has already been computed.

    So, to avoid computation redundancy, you may want to do this:
    void sqrAndCube(int x, int *y, int *z){
    *y=x*x;
    *z=(*y)*x;
    }
    int a,b;
    sqrAndCube(x,&a,&b);



    There are far more clever examples than that, better reason to use pointer (for example, if you need a circular list)
    But that is a basic one.


    6) As far as "why malloc"
    That is "why to I need to allocate 'with pointer' memory, since all variables are allocated some place".
    Well sometimes you can't know while programming how many memory you will need.
    So there is no way you can allocate directly as a variable the memory.

    Plus, the stack has often a limited size. So if you need lot of memory, you can't put it is the stack (as local memory)
    And even if you can, it can slow down a lot the speed of processus if you use too much stack memory.
    6 answers · 4 days ago
  • Some men are very hot and handsome...they flirt with you all the time... But they do the same with every other chick?

    Best answer: yes dont trust that type ,.cause they are not honest
    Best answer: yes dont trust that type ,.cause they are not honest
    7 answers · 5 days ago
  • I want to enter code?

    5 answers · 4 days ago
  • How much computer skill do you need to use Linux?

    I am the poster child for having no knowledge of computers and programming whatsoever, but the thought of trying Linux has always interested me (especially since I'm getting really fed up with Windows 10 and I'm not a huge Mac fan). However, from what I've heard, it's pretty tech heavy. So, exactly... show more
    I am the poster child for having no knowledge of computers and programming whatsoever, but the thought of trying Linux has always interested me (especially since I'm getting really fed up with Windows 10 and I'm not a huge Mac fan). However, from what I've heard, it's pretty tech heavy. So, exactly how much programming skill do I need to use Linux? I'm not planning on doing any crazy, in-depth stuff, I just need enough knowledge to use it like a normal, non-professional programmer person.
    10 answers · 1 week ago
  • Whats the code to import a datetime (yaer, month and day) in python?

    Best answer: import datetime
    now = datetime.datetime.now ()
    print (now.month, now.day, now.year)
    Best answer: import datetime
    now = datetime.datetime.now ()
    print (now.month, now.day, now.year)
    5 answers · 5 days ago
  • Why if Java runs so many things do I have to up-date it on my computer and nothing else?

    Best answer: I assume you are referring to "The Internet of Things". For example, if your refrigerator has device that keeps track of the groceries in the fridge. There may be a setting on your computer to update it automatically, but, if not, it not, it's because they think you want more control over what... show more
    Best answer: I assume you are referring to "The Internet of Things".

    For example, if your refrigerator has device that keeps track of the groceries in the fridge.

    There may be a setting on your computer to update it automatically, but, if not, it not, it's because they think you want more control over what happens on your computer.
    4 answers · 4 days ago