Anonymous
su
the pointer is passed to the *mystr?
you can access to string by pointer to string as char *mystr parameter of a function
Anonymous
you can access to string by pointer to string as char *mystr parameter of a function
so the address of "hello" is passed to the pointer *mystr
Amir
Printf takes pointer to first character of string for %s
Amir
su
cool!
Anonymous
tnx yall
su
Serenity
If I pass an int array to a function and explicitly specify that the function receives an int pointer , so is it allowed to treat the array as if it's a pointer ( performing pointer arithmetic ) ?
Alex
yes
Serenity
Is it like I am assigning the name of the array to a pointer of its type right ?
Alex
yes
M__
im trying to understand how c/cPP libraries work is there any particular source for understanding libraries other than the CPP STL book
Kenny
i think that it is like a black box, it allows you to use some functions
M__
K&R
Other than K & R ?
su
Other than K & R ?
books about boost TL
Serenity
I've a question about fgets function - Let's say I would like to store 200 characters from a file without the newline character , What should be the buffer size ? Does the function include '
Serenity
'\0' automatically ?
Serenity
Or should I write fgets(str,199,fp)
Serenity
int mat1 = (int)malloc(sizeof(int)*mat1_rows); if (!mat1) { printf("Memory allocation failure"); return 1; } for (int i = 0; i < mat1_rows; i++) { mat1[i] = (int*)malloc(sizeof(int)*mat1_cols); if(!mat1[i]) { printf("Memory allocation failure"); return 1; }
Anonymous
int mat1 = (int)malloc(sizeof(int)*mat1_rows); if (!mat1) { printf("Memory allocation failure"); return 1; } for (int i = 0; i < mat1_rows; i++) { mat1[i] = (int*)malloc(sizeof(int)*mat1_cols); if(!mat1[i]) { printf("Memory allocation failure"); return 1; }
if you want a lookup table, then line 1 should be int **mat1 = malloc(sizeof(int *) * mat1_rows); or even better int **mat1 = malloc(sizeof(*mat1) * mat1_rows); this should be followed by the allocation test and allocations and tests for each mat1[i]
Anonymous
int mat1 = (int)malloc(sizeof(int)*mat1_rows); if (!mat1) { printf("Memory allocation failure"); return 1; } for (int i = 0; i < mat1_rows; i++) { mat1[i] = (int*)malloc(sizeof(int)*mat1_cols); if(!mat1[i]) { printf("Memory allocation failure"); return 1; }
if you want a proper 2D array, then line 1 should be int (*mat1)[mat1_rows][mat1_cols] = malloc(sizeof(*mat1)); followed by usages of *mat1 such as (*mat1)[0][1] = 3; in this case you only need to check for one allocation, the remaining allocations and allocation checks are unnecessary.
Anonymous
Is there any well use json escape library?
Monday Morning
Given two integers ‘a’ and ‘m’, modular multiplicative inverse of ‘a’ under modulo ‘m’ exists only when 'a' and 'm' are co-prime. Can anyone prove the above please ? or provide a link where I can find it
Monday Morning
Ah ! use of Extended Euclidean Algorithm.
Monday Morning
Thank you !
Furkan
Furkan
I want to read integer input and store the value in vector until I press enter button but it gives me error ISO C++ forbids comparison between pointer and integer. What is the correct solution? thanks in advance everyone
2foryou
I am thinking of creating a project dealing with big numbers and I a looking for a library. I did use GMP on c++ in the past in a project with cryptography. I want to use the fastest known or the most common available or even thread based one,
Anonymous
Thank you I've read and understood hope to work together!!
Yaroslav
/get cppbookguide
Anmol
And compare on the basis of that. Your code is baaaaaad code
Anonymous
Anyone here from lte rrc protocol development field? I need any rrc layer message's source code file for preparation?
Anonymous
can someone recommend me a small multithreaded project? i picked up the C++ Concurrency in Action book, but so far it doesn't seem like it has exercises for me to do.
Dima
multiple producer multiple/single consumer queue ( ͡° ͜ʖ ͡°)
Anonymous
uhh
Anonymous
sure i guess. can extend that to the complete set of exercises on concurrency from an OS book
stranger
Will it be fine if I ask for some tips using c++?
stranger
I would like to contribute to git hub and open source projects but I am still at intermediate level of c++ and can't understand most of the project. Can anyone guide me how can I do it. I tried to Google it but can't come up with any concrete answer. By guidance I mean what should I know like, is there any specific library of c++ or anything else. So that I am able to contribute.
V01D
Depends on what project
V01D
I watched alot of tutorials, and I had my moments where I went: "oh...thats why the code does that thing... and thats why he programmed that way.."
V01D
Its best if the tutorial is opensource because I would look at the code, then the tutorial, and I would learn from it. If there is no repo for the tutorial, scroll forward to change the time, pause the video and try to look at what he is doing.
V01D
Personally I got better at reading code while developing a kernel. The thing about an OS from scratch is that you learn the language from all sides. From inline assembly and assembly to C/C++ (or C/C++ to assembly, as in calling C or assembly functions), to hardware or memory mapped programming to your own libc. (strlen, memcpy, etc...) Kernel development is hard when you start (there are many tutorials and it gets easy once you understand the basics) (I myself am just messing around with them and not taking it too seriously) but I believe you will gain an advantage over many other programmers with this.
V01D
You're welcome :)
Indolent
Manish
Hi, is there any STL function to covert octal to decimal?
sunshine 🌞
Thata why my mail is not sent today afternoon
Liam
/ban
Monday Morning
A 2D matrix of order m x n is given. lets denote this matrix by arr[m][n]; we are to select one element from each row in such a fashion that summation of all the elements is maximum .And also,for 1<=i<=m after selecting an element from row i ,the element to be selected from row (i+1) has to be from different column than that of element selected from row i. Can anyone please tell me what are the prerequisite for solving this problem ? I solved a similar question on codechef https://www.codechef.com/problems/THEATRE but the difference is values of m & n was known to me beforehand.
Lasha
Hey guys, any of you know what something like 0400:0130h means for register location? Really hard to google search, I can't find anything.
Anonymous
should be good enough for a ban
Anonymous
u could send a link
Anonymous
u could send a link
and what they tried
Anonymous
Implement boyer Moore search string
V01D
u could send a link
He might aswell just read the rules...
Anonymous
GURU
ok
Anonymous
i got it..
GURU
online exam
V01D
We wont help with that, read pinned message.
GURU
ok👍
Anonymous
ok👍
I don't understand why it is hard
Anonymous
Go to Wikipedia
Anonymous
Done?
GURU
yes👍
Winter 的色狗(對頻率中🔄)
Hi everyone. I am a beginner on C++ and programming. Now I am doing a question saw from StackOverFlow and I am struggling in the question. https://stackoverflow.com/questions/58405377/a-c-question-about-dice-probability-calculation This is the question I am doing. Hope you can give me help or insight to solve the question
Serenity
Lol It hasn't sent the rest of the code because of my awful internet connection . but I've already addressed the issue , thanks for your interest.
Winter 的色狗(對頻率中🔄)
https://pastebin.com/0LC8PiiX This is my code
Winter 的色狗(對頻率中🔄)
https://pastebin.com/0LC8PiiX This is my code
I am struggling in the throwing function. I don't know how to count all the combination.
Sathiya
I have written some junk data to mtd partition (/dev/mtd1). even though it is corrupted, I was able to mount that block. Actually it should fail. Any guess what might be the reason for that?