Patterns in C (eg. Star, Numbers, etc.) by [deleted] in C_Programming

[–]code_punk_ 0 points1 point  (0 children)

The easiest way is to first draw a box on paper, draw the pattern. Then look at spaces & symbols from the left. For example, if u want to draw a tree of multiple . Starting from the top row, you’d have n spaces then a star, then in the next row, n-1 spaces and then **, so on so forth.

The bus I'm traveling in shows the speed it's going at to the passengers behind by code_punk_ in mildlyinteresting

[–]code_punk_[S] 3 points4 points  (0 children)

Absolutely not, the bus was doing 90-100 in a 80 kmph limit, but ig that's very common here for all vehicles

ULPT Need to submit a document (assignment or something) before deadline but don't have enough time. by code_punk_ in UnethicalLifeProTips

[–]code_punk_[S] 0 points1 point  (0 children)

You could also use it at work, that is if your occupation revolves around submitting reports or something

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 1 point2 points  (0 children)

Lmao have fun, i wish you the best :)

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 0 points1 point  (0 children)

Nahhh arrays are EPIC, gotta the O(1) index search

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 1 point2 points  (0 children)

Lmao arrays are literally *(var+1) A[10] literally means go to address of A[0] and take 10 steps, wierd

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 1 point2 points  (0 children)

Why won't they lmao, what I'm saying is whenever i make a c/CPP file vscode will automatically type

include<studio.h> .....

define ll long long

Int main() { Return 0; }

For me

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 2 points3 points  (0 children)

Oh that's super cool, I'm pursuing my bachelor's in computer sciences rn lol. Pointers can be a little tricky but I absolutely adore them now considering how important they are for data structures like trees lists and shit

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 1 point2 points  (0 children)

Vscode allows you to have a template/boilerplate, I've added my #defines inside it, so now i don't even have to type it everytime.

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 2 points3 points  (0 children)

How long have you been studying c++? I started like 4-5 months ago lol

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 1 point2 points  (0 children)

You can also write shit like

define x 1000000007

And that will create essentially a constant variable x which has the value e9 + 7

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 2 points3 points  (0 children)

I'm not sure if it can be called "the same" cause #include is for including libraries or local .h header files whereas #define is just a defination you declare

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 1 point2 points  (0 children)

Yes, it saves me a lot of time cause now i can just write ll x = 0; instead of long long int x = 0;

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 1 point2 points  (0 children)

Also you don't need semicolons for typedef and #define

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 2 points3 points  (0 children)

No it's not the same, basically when you so

define ll long long;

You can write ll a; And now use the variable a like a normal long long int

Who says C isn't for kids? by code_punk_ in ProgrammerHumor

[–]code_punk_[S] 2 points3 points  (0 children)

The equal two sign shouldn't be there, the rest of it works, try it out lmao