klimi
Cool
Anonymous
Please correct my mistakes
klimi
Is it not working?
Anonymous
Yes
Anonymous
Line 74 & 85 are comments... Minor mistake though
Anonymous
Is it not working?
I was trying to implement OOP
klimi
okay
Anonymous
I'm new to it
klimi
okay
klimi
i cant run it tbh
Anonymous
Hello guys !! I Know this is mainly for c/c++ But can I ask questions pertaining js and php!?
klimi
mm rules says to keep it to minimum
Anonymous
Ok
Anonymous
Is there any possibility of using JS to restrict the page not to go back Once a person click on back icon in a window then it will display that you can't go back and then it takes a person to a login form? Or in php!?
Fa~
Someone tell me how to convert commandline argument into an input in C program please
Anonymous
i cant run it tbh
Yep... Can you point out my mistakes?
klimi
i dont know what are those getline at the top
klimi
it hsouldnt be there... its just definition,.... you dont need getlines (functions)
klimi
because you will init the class in the main
klimi
line 68 doesnt have ;
klimi
line 35 there is dot
Anonymous
i dont know what are those getline at the top
Get input and Store it in the variable
klimi
but
klimi
you dont have starting point in the program
klimi
you can do that in constructor
klimi
but not in defining
Anonymous
Can i dm?
klimi
dm?
Anonymous
Can i inbox you if you don't mind
klimi
why?
Anonymous
I'll tell you there why
klimi
k
Óscar
argc is the number of command line arguments(including the name of the program)
Óscar
And argv is an array where each element is an argument
Óscar
argv[0] is the name of the program, argv[1] is the first argument etc
basicv1
Help me please..... Simulate the following non-preemptive CPU Scheduling algorithms to find turnaround time and waiting time FCFS SJF Round Robin (Pre-emptive) Using C
Anonymous
Sounds like homework
Anonymous
so no
Anonymous
no help
Anonymous
tbf, I'd be no help. That's nothing close to my strong point
Anonymous
the concepts of pointers still fucks my brain for today
Anonymous
why in the C strings , its invalid to use *string
Anonymous
you just define it as a charecter array pointer , but you can't use it as a pointer
Anonymous
you have to use the & mark to refernce it , why a normal pointer should just give back the address when the * mark isn't there
Anonymous
and , a void pointer , can't be derefenced when it points to char pointer for e.g , it will give segfault
Anonymous
Anonymous
Anonymous
and , any explaination to this results ?
Anonymous
why *rp -> 1 ? why not 0 while it still not holding any reference to anything ?
Anonymous
why the *ip even 4 ?
Anonymous
also it still not pointing to anything , not holding any refernce too
Anonymous
but ig the last 2 things Ik why
Anonymous
because I am getting the address of a pointer which is 8 bytes and they making a pointer to that address then coming back and the function computing the sizeof the mem location which the pointer points to , which is the address of the old pointer which is 8 byte in fact
Anonymous
but the thing is , is C initialize the pointers with a non-null value if I didn't initialize them manually ?
Anonymous
and is the concept of pointers supposed to be like that ( brain fuck ) or am I missing something or understood something wrong somehow ?
klimi
isnt the pointers to only offset?
klimi
im only guessing
Anonymous
im only guessing
just don't , I am having enough amount of guesses and confusion lol
klimi
ok :D
klimi
im trying to configure vim
olli
With sizeof(*rp) you dereference a void pointer, you should never do this! Hence you get the size of a void which is 1. To get the size of the pointer use sizeof(rp), this size should equal the size of all other pointers. With sizeof(*ip) you are requestjng the size of an int, which is on your platform 4 bytes, same as sizeof(int). Only the last two examples print the size of a pointer. Hello is a pointer to constant characters, you can use this as a regular pointer, although you cannot modify the content when pointing to the "hello world" string Does this help?
Anonymous
Yooo am new
Dima
Anonymous
same goes for the int pointer
Mat
When you declare a variable, it will have a mem address bound to it
Mat
Cause pointers are variables
olli
z is uninitialized (at least without a static storage location) and using the value is actually undefined
Anonymous
sizeof has nothing to do with the location. When not defining where the pointer points to it is uninitialized. Hence dereferencing is undefined
uninitialized so it should hit some sort of errors instead of giving back unexpected results when I am trying to dereference the pointer which isn't holding any address to be dereferenced despite that I am doing that inside a function or not , ig
olli
uninitialized so it should hit some sort of errors instead of giving back unexpected results when I am trying to dereference the pointer which isn't holding any address to be dereferenced despite that I am doing that inside a function or not , ig
There are no errors, compilers might generate warnings. Every variable, pointer and so on has a value, since at the location it is allocated at there is some value. However you dont know the value. So accessing it yields undefined behavior
Anonymous
The same applies to an integer value . Consider this int z; sizeof(z); The value of z does not matter, since sizeof depends on the type
ikr , but the thing is , why it didn't just did that ? it has returned the actual pointer size (not the type size), this is what I am asking , why it happened ?