3rd printf is new to me, what could be the reason for such behavior?

|
armanhrshaikh 2022-08-11 17:28:56
I wanna read job.txt from terminal assign inside crobtab -e
armanhrshaikh 2022-08-11 17:29:14
Fibonakki 2022-08-10 05:51:53
Which command?

at command

armanhrshaikh 2022-08-11 17:34:43
marcotrosi 2022-08-09 18:59:08
no, a private group, the python you linked is insanely huge and I’ve been told not very helpful

I observed that’s unfiltered group.

armanhrshaikh 2022-08-11 17:34:48
I am an Indian but I can’t deny the truth.

If you find any group where
indian , pakistani, Bangladeshi teens are in huge then that group tends to corrupt by

1. Spammers
2. Unnecessary chats
3. Female addicts

Fibonakki 2022-08-11 17:35:15
armanhrshaikh 2022-08-11 17:29:14
at command

Idk what’s more weird the way you ask questions or your profile content.

armanhrshaikh 2022-08-11 17:37:46
Fibonakki 2022-08-11 17:35:15
Idk what’s more weird the way you ask questions or your profile content.

That I always avoid and still stick to cronjob

Fibonakki 2022-08-11 17:39:58
armanhrshaikh 2022-08-11 17:37:46
That I always avoid and still stick to cronjob

Pls don’t do this to me 🤣🤣

armanhrshaikh 2022-08-11 17:49:23
Fibonakki @marcotrosi
Constab job back-up and restore not working.
BytesIO 2022-08-11 19:31:30
offtopic c question
https://cplayground.com/?p=cheetah-antelope-giraffe

is this syntactical sugar for accessing elements in c? *(id+index)

C PlaygroundCplayground
Quickly test C and C++ code online.
raytracer9 2022-08-11 20:35:35
BytesIO 2022-08-11 19:31:30
offtopic c question
https://cplayground.com/?p=cheetah-antelope-giraffe

is this syntactical sugar for accessing elements in c? *(id+index)

I can’t say if this is syntactical sugar (maybe known as something else 🤔) but it’s a way to access values stored in an address (which is what basically pointer store) and this expression is helpful in pointer arithmetic

BytesIO 2022-08-11 20:36:41
raytracer9 2022-08-11 20:35:35
I can’t say if this is syntactical sugar (maybe known as something else 🤔) but it’s a way to access values stored in an address (which is what basically pointer store) and this expression is helpful in pointer arithmetic

ah okay now i got it. so its adding 1 to the base address of array which points to the index of 0

raytracer9 2022-08-11 20:37:10
BytesIO 2022-08-11 20:36:41
ah okay now i got it. so its adding 1 to the base address of array which points to the index of 0

Yes,

BytesIO 2022-08-11 20:37:29
raytracer9 2022-08-11 20:37:10
Yes,

understood thank you

raytracer9 2022-08-11 20:37:51
Start using this expression with 2D and possibly 3D arrays and enjoy the ride 😅
Kueppo 2022-08-11 20:37:55
BytesIO 2022-08-11 19:31:30
offtopic c question
https://cplayground.com/?p=cheetah-antelope-giraffe

is this syntactical sugar for accessing elements in c? *(id+index)

That was the old way to do it, some masters discourage the use of this syntax.

BytesIO 2022-08-11 20:38:28
yeah I have heard pointer artihmetics is bad ( unsafe 😅 )
marcotrosi 2022-08-11 20:38:39
BytesIO 2022-08-11 19:31:30
offtopic c question
https://cplayground.com/?p=cheetah-antelope-giraffe

is this syntactical sugar for accessing elements in c? *(id+index)

you wanna see something crazy?

marcotrosi 2022-08-11 20:38:44
unixusergroup-48793.jpg

BytesIO 2022-08-11 20:39:20
so the last one was possible huh
marcotrosi 2022-08-11 20:39:26
you know why?
raytracer9 2022-08-11 20:39:28
marcotrosi 2022-08-11 20:38:44

3rd printf is new to me, what could be the reason for such behavior ?

BytesIO 2022-08-11 20:39:40
I tought the answer key was wrong 🤦‍♂️
BytesIO 2022-08-11 20:39:48
marcotrosi 2022-08-11 20:39:26
you know why?

please tell

marcotrosi 2022-08-11 20:40:31
because the 2nd and 3rd one are both translated to the first one internally. and it doesnt matter if it’s x+3 or 3+x, the address result is the same
Kueppo 2022-08-11 20:41:17
marcotrosi 2022-08-11 20:38:44

it’s as crazy as this

#include <stdio.h>

int
main()
{
int ar[] = { 23, 10, 2 };
int *p = ar + 2;

fprintf(stdout, “%dn”, p[-1]);

return 0;
}

Kueppo 2022-08-11 20:42:23
marcotrosi 2022-08-11 20:38:44

the third one is a mistery to me 😂

BytesIO 2022-08-11 20:42:35
Kueppo 2022-08-11 20:41:17
it’s as crazy as this

#include <stdio.h>

int
main()
{
int ar[] = { 23, 10, 2 };
int *p = ar + 2;

fprintf(stdout, “%dn”, p[-1]);

return 0;
}

whats the answer to this?

Kueppo 2022-08-11 20:42:40
10
marcotrosi 2022-08-11 20:42:52
normal pointer arithmetic here
BytesIO 2022-08-11 20:42:56
ok mind blown
marcotrosi 2022-08-11 20:43:18
address of ar + 2 is the 3rd element (value 2), and then -1 from there is the value 10
BytesIO 2022-08-11 20:43:20
Kueppo 2022-08-11 20:41:17
it’s as crazy as this

#include <stdio.h>

int
main()
{
int ar[] = { 23, 10, 2 };
int *p = ar + 2;

fprintf(stdout, “%dn”, p[-1]);

return 0;
}

*p will contain the addr of 2 right?

raytracer9 2022-08-11 20:43:37
BytesIO 2022-08-11 20:42:35
whats the answer to this?

10 ofc, p will point to 3rd value and -1 is operating just like what @marcotrosi told

marcotrosi 2022-08-11 20:43:40
but of course it’s dirty
BytesIO 2022-08-11 20:44:08
p[-1] is basically p-1 ?
|