Thread: Overwriting

  1. #1
    Banned
    Join Date
    Apr 2015
    Posts
    596

    Overwriting

    Hey all! Well there something still confusing me in C.
    When I write i=0 and afterwards i=5; the recent number of i is the value of it; but why? What's going on pc exactly? is it a property of pc to overwrite? If so how is it going?


    Sorry for the silly question but it's confusing me alot!!

  2. #2
    Registered User
    Join Date
    Dec 2017
    Posts
    1,633
    Well there something still confusing me in C.
    There is a great deal still confusing you in C.


    Yes. Of course it is overwritten. What's so hard to understand about that? If it wasn't overwritten, where would the old value go? Would they just accumulate in memory until it was full? That would be stupid, wouldn't it?
    A little inaccuracy saves tons of explanation. - H.H. Munro

  3. #3
    Registered User Kernelpanic's Avatar
    Join Date
    Sep 2018
    Location
    Berlin
    Posts
    105
    What is with your Linux experience? Forgot?

    RyanC, you are a Troll?

    https://www.com-magazin.de/img/5/1/2..._w492_h312.jpg

  4. #4
    Banned
    Join Date
    Apr 2015
    Posts
    596
    Quote Originally Posted by john.c View Post
    There is a great deal still confusing you in C.


    Yes. Of course it is overwritten. What's so hard to understand about that? If it wasn't overwritten, where would the old value go? Would they just accumulate in memory until it was full? That would be stupid, wouldn't it?
    What do you mean overwritten? ..replacing data? If so where the replaced data will go after replacing?!
    Maybe I miss understanding the term overwritten..if u can illustrate please

  5. #5
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    It's like having a cake on the table and when you want to replace it with another cake you smash the second on the first.
    Devoted my life to programming...

  6. #6
    Banned
    Join Date
    Apr 2015
    Posts
    596
    I can say that I could just say the replaced data will be removed while overwritten but I couldn't imagine the process of how pc doing that!.. I guess he delets data first and then write

  7. #7
    Banned
    Join Date
    Apr 2015
    Posts
    596
    Quote Originally Posted by GReaper View Post
    It's like having a cake on the table and when you want to replace it with another cake you smash the second on the first.

    sorry What? didnt understand you at the end smash the second on the first..

  8. #8
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    It depends. Solid state drives, for example, have to delete a sector before writing to it. HDDs and RAM on the other hand can replace their data without wiping.
    Devoted my life to programming...

  9. #9
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Quote Originally Posted by RyanC View Post
    sorry What? didnt understand you at the end smash the second on the first..
    You know, you place the second on the first in such a way that the first is squashed.

    EDIT: Now that I think about it, it's not a good analogy... ignore it.
    Last edited by GReaper; 12-04-2018 at 05:39 PM.
    Devoted my life to programming...

  10. #10
    Banned
    Join Date
    Apr 2015
    Posts
    596
    Quote Originally Posted by GReaper View Post
    It depends. Solid state drives, for example, have to delete a sector before writing to it. HDDs and RAM on the other hand can replace their data without wiping.
    So in abbreviation; overwrite means delete +write? Meaning the pc is deleting before writing? Sorry Bout that but for just closing this point i need to understand it

  11. #11
    Banned
    Join Date
    Apr 2015
    Posts
    596
    What's confusing me lets say in real life i want to write on a line ... If its fully and pre-written as I get a eraser and wipping out what's written and afterwards writting.. But how its going in computing science

  12. #12
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Yes, when you overwrite something with something else, you're implicitly deleting the previous contents.
    Devoted my life to programming...

  13. #13
    Banned
    Join Date
    Apr 2015
    Posts
    596
    Once again i can like a parrot just say the
    replaced data smashed! ; my question is pc has apility to smash and wipe out unlike our roleplay?!

  14. #14
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Quote Originally Posted by RyanC View Post
    What's confusing me lets say in real life i want to write on a line ... If its fully and pre-written as I get a eraser and wipping out what's written and afterwards writting.. But how its going in computing science
    I can give you a nice example for that. The computer does the following:
    1) Copy the line in its temporary memory.
    2) Changes it as much as it likes.
    3) Overwrites the old line with the modified line.
    Devoted my life to programming...

  15. #15
    Banned
    Join Date
    Apr 2015
    Posts
    596
    Quote Originally Posted by GReaper View Post
    I can give you a nice example for that. The computer does the following:
    1) Copy the line in its temporary memory.
    2) Changes it as much as it likes.
    3) Overwrites the old line with the modified line.
    So the term Overwrite is "delete the old+writes the modified"?
    Meaning with this; that's the pc isn't actually write on the old data; it aipe the old data then write; this process called OverWrite...ye?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Am I overwriting my linked list?
    By roud9 in forum C Programming
    Replies: 2
    Last Post: 12-03-2015, 10:20 PM
  2. array value overwriting another
    By RyanW2050 in forum C Programming
    Replies: 2
    Last Post: 01-27-2012, 01:34 AM
  3. Overwriting all in array, why?
    By guesst in forum C Programming
    Replies: 7
    Last Post: 10-09-2008, 05:56 PM
  4. Overwriting a character
    By WanTeD in forum C Programming
    Replies: 3
    Last Post: 05-12-2003, 04:36 AM
  5. Writing to a file without overwriting
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 04-10-2002, 09:21 PM

Tags for this Thread