{"id":17766468,"url":"https://github.com/dmitry/learn-c","last_synced_at":"2026-01-31T11:02:38.641Z","repository":{"id":6354104,"uuid":"7590972","full_name":"dmitry/learn-c","owner":"dmitry","description":"Learning C language","archived":false,"fork":false,"pushed_at":"2014-01-14T01:30:29.000Z","size":132,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-11T07:12:07.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmitry.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-13T17:25:28.000Z","updated_at":"2014-06-28T23:19:05.000Z","dependencies_parsed_at":"2022-09-12T23:01:24.990Z","dependency_job_id":null,"html_url":"https://github.com/dmitry/learn-c","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dmitry/learn-c","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmitry%2Flearn-c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmitry%2Flearn-c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmitry%2Flearn-c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmitry%2Flearn-c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmitry","download_url":"https://codeload.github.com/dmitry/learn-c/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmitry%2Flearn-c/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28939499,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T10:18:23.202Z","status":"ssl_error","status_checked_at":"2026-01-31T10:18:22.693Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-26T20:30:05.382Z","updated_at":"2026-01-31T11:02:38.623Z","avatar_url":"https://github.com/dmitry.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Here are my notes for the C language, that I've made for a quick reference in the future. It something like a cheatsheet, but very personal.\n\n```c\nint a[4] = {1,2,3,4};\nint a[] = {1,2,3,4};\nint a[] = {0};\nint *pa;\nint **pb;\n```\n\ntake third element of an array\n\n`a[3] == *(a + 3) == 3[a] == *(\u0026a[0] + 3)` - basically array variable is a pointer on a first element of array\n\n```c\nif (a[3] == *(a + 3) \u0026\u0026\n  a[3] == 3[a] \u0026\u0026\n  a[3] == *(\u0026a[0] + 3)) {\n  printf(\"yey\");\n}\n```\n\n`*pa` - get value\n\n`pa` - get or set memory location\n\n`pa = a`\n\n`pa = \u0026a[0]` - the same as above\n\n`*a` - get first element of array\n\n`int \u0026b` - reference, cannot be NULL or uninitialized\n\n`pa = \u0026b` - get address of variable and assign it to pointer\n\n`**pb = \u0026pa` - reference on reference\n\n### Function pointer (similar to C++ templates)\n\n```c\n#include \u003cstdio.h\u003e\n\nint referenced(int val) {\n  return 2 * val;\n}\n\nvoid execute(int (*ptr)(int)) {\n  printf(\"%d\\n\", ptr(3));\n}\n\nint main() {\n  int (*ptr_func)(int) = \u0026referenced;\n\n  execute(ptr_func);\n\n  return 1;\n}\n```\n\n## Debugging\n\n* strace\n* ltrace\n* dtrace\n* ktrace\n\n## References\n\n* http://en.cppreference.com/w/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmitry%2Flearn-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmitry%2Flearn-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmitry%2Flearn-c/lists"}