UrCodeBuddy️ 💻
python is like writing english
Strife
Are you new to programming?
artemetra 🇺🇦
don't we all? i still use it though
artemetra 🇺🇦
me too
UrCodeBuddy️ 💻
UrCodeBuddy️ 💻
i feel ur pain
Strife
Well, every language has its own characteristics and goals
UrCodeBuddy️ 💻
soooo many things to keep in mind
UrCodeBuddy️ 💻
but i feel that from learning C++ i actually got the sense of programming
UrCodeBuddy️ 💻
like more understanding of computers and what we are exactly doing
Strife
We have high-level, low-level and intermediate languages The higher the level, the easier it is for humans to understand
UrCodeBuddy️ 💻
😂😂 u will too
UrCodeBuddy️ 💻
no, python is higher than C++
UrCodeBuddy️ 💻
c and c++ is more machine friendly
Strife
Go research programming languages I think this is a good start for this path
UrCodeBuddy️ 💻
its better to learn, but are u going to use it ? most probably no
Ludovic 'Archivist'
Learning Python may be enough to hack around a small web server or a tiny prototype, but it will neither teach you as much (in terms of computer science knowledge) to learn Python instead of C++
C++ encompasses a lot of tools for manipulating the computer the way it actually operates as well as advanced concepts like dependent types, constraint based programming, generic programming, static and dynamic polymorphism, resource management, functional programming and lambda calculus
Ludovic 'Archivist'
\Device\NUL
\Device\NUL
Anonymous
why not stl
tkali
What's wrong with this
Char c = 'w'
Emkay
Hello World
xe
cout<<"hello everyone";
מנחם
How do I print the names in enum instead of their values?
enum status( true = 1, false = 0)
cout « status(1);
output: false. (not 0)
מנחם
Sarah
Can I run code written for an visual studio IDE editor in another editor?
Eradzh
How can I check if the data type is integer? unistd.h library only allowed
Ravi
%Nikita
Hi all! Could it be that I haven’t strndup function, while I have strdup in my compiler?
#include <string.h>
char* strdup (const char* str); //available
char* strndup (const char* str, size_t n); //I haven’t got this one
%Nikita
But I can just do this:
char* strndup( const char* str, size_t size ){
char* res = strdup( str );
if ( strlen(res) > size){
res = realloc(res, size);
res[size-1] = ‘\0’;
}
return res;
}
But it is boring, you know?
Hanz
Nova
Hey guys
What do you use to debug your c++ code
Like in visual studio code It's get confusing sometimes
Do you guys any simple(visually easy looking) way to do it .....
Or just reply this message with what you use as an ide
Marina
hello! I have a quick question.
What does a program do when I run it using “./main &”?
Marina
is it run sequentially or parallel?
klimi
Marina
Norah
I have problem when use include<freeimage.h>and the stackflow it is not have solution for my problem
Norah
<freeimage>not found
\Device\NUL
\Device\NUL
How can I check if the data type is integer? unistd.h library only allowed
Just check the sizeof the data, library doesn't have any related to data type.
int in x86-64 arch on linux is 4 byte so it is double word
Note : I haven't explore more about assembly
Use equ to find its size
section .data
arr dd 0
; static int arr = 0
str db "sizeof int is "
; static char str[] = "sizeof int is "
len equ $-str
; static size_t len = sizeof(len)
sz equ $-arr
; static size_t sz = sizeof(arr)
section .text
global _start
_start:
mov edi, 1
mov esi, str
mov edx, len
mov eax, 1
syscall
; write(1, str, len)
mov eax, [sz]
add eax, 48
mov sz, eax
mov edi, 1
mov esi, sz
mov edx, 1
mov eax, 1
syscall
; write(1, sz, 1)
xor edi, edi
mov eax, 60
syscall
; _exit(0)
Norah
Sergio
Check added path is accessible from your project folder
Silent
#include<stdio.h>
#define n 5
int main()
{
int a[n],b[n],i,j;
printf("Enter the FIVE elements of array : ");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("original elements of array : ");
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
printf("\n\n\n New arry with reverse element : ");
for(i=n-1,j=0;i>=0;i--,j++)
{
b[j]=a[i];
}
for(i=0;i<n;i++)
{
printf("%d ",b[i]);
}
return 0;
}
Silent
How can I do it with single array
loutre
You swap a[i] with a[len - i] and vice-versa
king king
Is someone familiar with the
"Effective STL" book ?
r3tr0m
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
int main(int argc,char *argv[]){
if(argc < 4){
printf("%s <filename> <filename> <word>\n",argv[0]);
return EXIT_FAILURE;
}
char *word_target = argv[3];
short int word_size = strlen(argv[3]);
printf("Target: %s\n",word_target);
printf("Size: %i\n",word_size);
FILE *file_1 = fopen(argv[1],"r");
FILE *file_2 = fopen(argv[2],"r");
if(file_1 == NULL || file_2 == NULL){
printf("File error: %s\n",strerror(errno));
return EXIT_FAILURE;
}
fseek(file_1,0,SEEK_END);
fseek(file_2,0,SEEK_END);
unsigned int file_1_size = ftell(file_1);
unsigned int file_2_size = ftell(file_2);
fseek(file_1,0,SEEK_SET);
fseek(file_2,0,SEEK_SET);
printf("File_1 -> %i\n",file_1_size);
printf("File_2 -> %i\n",file_2_size);
int fmsize = 0;
int8_t state = 0;
if(file_1_size > file_2_size){
fmsize = file_1_size;
state = 1;
}else if(file_2_size > file_1_size){
fmsize = file_2_size;
state = 2;
}else{
fmsize = file_1_size;
state = 0;
}
char file_buffer_1[file_1_size];
char file_buffer_2[file_2_size];
fread(file_buffer_1,sizeof(char),file_1_size,file_1);
fread(file_buffer_2,sizeof(char),file_2_size,file_2);
unsigned int actual_byte = 0;
char *buffer_pointer;
unsigned int file_size;
unsigned int word_found = 0;
unsigned int word_found_file_1 = 0;
unsigned int word_found_file_2 = 0;
for(int i_file = 0;i_file < 2; i_file++)
{
if(i_file == 0){
printf("[+]Loop: %i\n",i_file);
buffer_pointer = &file_buffer_1[0];
file_size = file_1_size;
}else{
printf("[+]Loop %i\n",i_file);
buffer_pointer = &file_buffer_2[0];
file_size = file_2_size;
}
printf("%i\n",file_size);
while(actual_byte < file_size)
{
if(strncmp(&buffer_pointer[actual_byte],word_target,word_size) == 0)
{
printf("\033[31m%s",word_target);
printf("\033[0m");
word_found++;
actual_byte+=word_size-1;
}else{
printf("%c",buffer_pointer[actual_byte]);
}
actual_byte++;
}
if(i_file == 0){
word_found_file_1 = word_found;
}else{
word_found_file_2 = word_found;
}
actual_byte = 0;
word_found = 0;
}
if(word_found_file_1 > 0 && word_found_file_2 > 0)
{
printf("---------Files Match Words---------\n");
printf("[+] File_1 -> %i\n",word_found_file_1);
printf("[+] File_2 -> %i\n",word_found_file_2);
}else{
printf("[!]There is no math\n");
}
fclose(file_1);
fclose(file_2);
}
hamza
what are header files like a simple explanation?
what i understand is they are files that have stocked functions or serve a functionality in the code
like imports in oop ??
i guess i don't understand it if c was imperative then why and how and external ( header file that's not inside the code ) get's called inside the code and do it's thing i don't understand
coal
coal
you have a header file with declarations, and a cpp file with definitions
coal
if you change the cpp file, only that gets compiled, and everything else remains the same
coal
if you put the definition in the header file, everything that uses it must be compiled again for every time you change it
coal
so, it's easier and more efficient to keep your definitions in a file apart to avoid extra compilation time
coal
coal
i default to "cpp" because im used to it lol
hamza
You were talking about or cpp
coal
but both C and C++ header files serve the same purpose
hamza
Ohh okay cool
Chinepun💛
Anyone know a Site to get Jobs related to C++?
Pavel
Alex
Which is the best software and app for C programming?
redfox
what?
redfox
Alex
redfox
what is app for c
redfox
u mean idle
Alex
An app I can use for C coding
redfox
ye that i not called a app
redfox
that is called idle
redfox
i am currently using vscode
redfox
but you have to find what suits you the most
Adarsh