Serenity
I'll explain it more specifically
Serenity
I have a supermarket struct
Serenity
and It has product ** product_list field
Serenity
I want to increment **product list field
Anonymous
#include<stdio.h> int main() { int a[2] = {0,1}; int *b = a; int **c = &b; (*c)++; printf("%d", **c); }
Anonymous
Here's an example
Anonymous
Good luck
Anonymous
#noendl
NXiss7
Dafaq
NXiss7
No garbage collector? 🤔
Are you kidding? This is C/C++
Anonymous
Solution please?
Prosvetlennii Dimas
Help me with cmake pls. I found SFML via find_package and want to add .dll files from package to the install location. How to do this
Vishnu
Solution please?
I guess a counterexample will be enough to disprove the statement🤔
Anonymous
Solution please?
/warn solution asking
Anonymous
Solution please?
/warn offtop
Anonymous
Should I give her the third warn about screen photo?🤔
Anonymous
So if someone post screen photo of ads should banned immediately
Anonymous
/get cbook
Pasindu
/get
Anonymous
/get
Anonymous
/get ide
Anonymous
No garbage collector? 🤔
There is one if you're interested
Anonymous
It replaces the current memory allocator with itself
Dima
/warn read the rules
🐢
Can you recommend me a book for c application/examples
...
Char *str="Nice test" ;
...
Char *str="Nice test" ;
What will the identifier str will store ?
Francisco
What will the identifier str will store ?
Being precise, it stores a memory direction (0x9813afc2, for example), where every contiguous byte represents a character
Francisco
The problem is that in C++ you can't convert a const char* into a char*, but I think you can in C
Anonymous
Anonymous
const char* example is: char *a = "string";
Anonymous
You are assigning a const char * string literal to a char
Anonymous
const char* example is: char *a = "string"; Now if we do this: a[1]=NULL; The program will segfault This is because modifying a string literal is undefined
toytta
Good morning fellas Someone here knows how to read, recognize and print the dimensions of an .png archive in C? If yes, could you help me?
Karan
Calling all coders. At 6 PM today play CodeCarnival organised by IIIT Naya Raipur and Dare2Compete Online Hackathon Festival (OHF) Season 2 and stand a chance to win prizes worth INR 50K, eCertificates to Top 100 for excellence and to all for Participation. To register and to play head to https://d2c.pw/wH22n #OHF #OnlineHackathonFestival #D2COHF #Dare2Compete #StayHome #StaySafe #KeepCoding
Francisco
No you can't
https://godbolt.org/z/5eJYyi
Francisco
Yes I can, or at least gcc 10.1 lets me do it
Francisco
Other thing is modifying something, but at least gcc and clang definetly lets me do it
Cool Guy
Hello People Can anybody tell me how to convert this algo in c program.
Cool Guy
Please can anybody guide me in this?
Artöm
Write a function array_sum(int* rr, size_t n) (or float if it's an array of float values)
Artöm
Algo is given man. Sum all elements in a variable in for loop, then return the variable
Anonymous
Hello People Can anybody tell me how to convert this algo in c program.
static long int sum(int arr[], size_t size) { static long int sum,i; for(;i<size;++i) sum+=arr[i]; return sum; }
Anonymous
The time complexity of this algorithm is a constant n where n=size
Gregory
O(N). Lenear
Anonymous
...- string literals have a type...
Anonymous
...i always thought they were some internal compiler representation that could be assigned to const char *
Artöm
...- string literals have a type...
Yes, const char[N] in C++, dunno if in C they are const
Anonymous
Think about it
Anonymous
Array is a contiguous allocation
Anonymous
You know that pointer + offset will be the next element to the array
Anonymous
Whatever that offset be, depends on the architecture
Anonymous
But when you declare char *a ="something";
Anonymous
*(a+1) points to something entirely different
Dima
then ban instead
nah its okay, I got a pm
klimi
uwu
klimi
i will go do some coding
Artöm
*(a+1) points to something entirely different
It points to second char in this string duh
Artöm
I can prove it. Can you contra?
Anonymous
Hi guys! cant reallocate memory. what's wrong? typedef struct date { int day; int mon; int year; }DATE; DATE *arr; int size = 1; arr = malloc(sizeof(DATE)); for (; scanf("%d.%d.%d", &arr[size].day, &arr[size].mon, &arr[size].year) == 3; size++) { arr = (DATE*)realloc(arr, ((1 + size) * sizeof(DATE))); }
Artöm
Whatever that offset be, depends on the architecture
It equals to sizeof(*ptr) * offset bytes so what?
Anonymous
ops) size = 0?
Anonymous
thanks)
Francisco
Really? Hard to believe, though
Dima
lol!
Dima
never believe anyone
Dima
in fact, in my country the real professors are at the same level lol
Francisco
Well, claiming something doesn't make it true. I've seen horrible teachers, but none of them was so wrong about their subjects (or at least not THAT wrong)