language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | void foo (int x, int c, char h);
int f(void)
{
return 0;
}
int x = 3;
// int deklaracijaBezDefinicije(int x); // deklaracija bez definicije
int main(void)
{
int a = 5;
const char c = 'i';
int niz[3];
void foo (int x, int c, char h);
int x = 5;
int y = x ... |
C | //
// Created by 大泽 on 2018/9/20.
//
#include "stdlib.h"
#include "union_find.h"
#include "graph.h"
#include "stdio.h"
#define MAX 100
struct Tree {
edge All_edges[MAX];
int len;
} treelist;
graph Graph;
int cmp(const void *a, const void *b) {
edge *pa = (edge *) a;
edge *pb = (edge *) b;
return... |
C | #include <stdio.h>
#include <stdlib.h>
#include "main_menu.h"
/*
Indications du prof :
- L'eleve ne s'incrit pas, c'est l'administrateur qui l'inscrit
- L'admin peut enrregistrer des eleves, affecter des profs, creer des grouoes ...
- L'eleve peut juste afficher son planning
- les tableaux doivent tre dynamiques
- P... |
C |
//Project Name: DefaultProject
//Owner: gmello
//UID : 1000
#include<stdio.h>
#define TAMANHO 10
void ler_vetor( int pvetor[TAMANHO-1] ){
// Ler do vetor
printf("Digite os elementos do vetor : \n");
for( int i=0; i < TAMANHO; i++){
printf("%d: ", i+1);
scanf("%d", &pvetor[i] );
}
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
struct node {
int data;
struct node *next;
struct node *prev;
};
typedef struct node LINKITEM;
LINKITEM *head = NULL;
LINKITEM* getNewNode(int data) {
LINKITEM *newNode = malloc(sizeof(LINKITEM));
if (newNode == NULL) {
return NU... |
C |
/* Exercise 6.4
The program uses structures to make tree of word from input. Then
word will be printed in frequency order. */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
/* structure is node in tree of words */
struct tnode {
char *word;
int count;
struct tnode *le... |
C | #include<stdio.h>
#include<string.h>
#include<conio.h>
void main(void)
{
int arr[3][4];
int i,j,sum;
float avg=0;
sum=0;
clrscr();
printf("enter arr:");
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
scanf("%d",&arr[i][j]);
// printf(" %d",arr[i][j]);
}
//printf("\n");
}
// get sum of each r... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
void main(void)
{
/* pointer to stat struct */
struct stat sfile;
/* stat system call */
stat("data", &sfile);
/* access st_mode (data member of stat struct ) */
printf("st_mode = %d\n", sfile.st_mode);
}
|
C | #include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
typedef struct _AVLNode {
int val;
int deltaH;
struct _AVLNode *pParent, *pLeft, *pRight;
}AVLNode;
/**
* LL-Rotate
*
**/
AVLNode *LLRotate(AVLNode *pRoot)
{
AVLNode *pLeftChild, *pLeftChildRight, *pParent;
pLeftChil... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* weapons.c :+: :+: :+: ... |
C | #include"Parking_h"
#include<stdio.h>
#include<stdlib.h>
#include<bool.h>
#include<malloc.h>
using namespace std;
typedef int ElemType1;
typedef struct qnode{
ElemType1 data;
struct qnode *next;
}DataNode;
typedef struct{
DataNode *front;
DataNode *rear;
}LinkQuNode;
void InitQueue(LinkQuNode *&q){//初始... |
C | #include <stdio.h>
#include "ft_randlib.h"
int main(int argc, const char *argv[])
{
int max;
int rand_v;
int seed;
max = 0;
if (argc > 1)
max = ft_atoi(argv[1]);
if (max < 0)
return (1);
seed = 0;
if (argc == 3)
seed = ft_atoi(argv[2]);
printf("seed :%d\n", seed);
if (seed)
ft_srand(seed);
ran... |
C | //-----------------------------------------------------------------------------
/* Структуры данных, используемые при работе с единицами измерений.
Примеры единиц измерений - метры, мили, секунды, атмостеры, Вольты, Амперы, и т.д.
Все единицы сгруппированы в некоторое кол-во групп (пока 10):
единицы длины, времени, ма... |
C | /* prod_no_condvar.c
A simple POSIX threads producer-consumer example that doesn't use a condition variable.
See also prod_condvar.c.
*/
#include <time.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <errno.h>
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
sta... |
C | /*
** cwd.c for PSU_2016_myftp in /home/god/TEK2/NETWORK/PSU_2016_myftp/sources/cmd/cwd.c
**
** Made by Maxime PILLON
** Login <maxime.pillon@epitech.eu>
**
** Started on Wed May 10 14:25:51 2017 Maxime PILLON
** Last update Wed May 10 14:25:51 2017 Maxime PILLON
*/
#include <unistd.h>
#include <string.h>
#includ... |
C | /*
* Directorios.c
*
* Created on: 11/11/2017
* Author: utnso
*/
#include "Directorios.h"
#include "Globales.h"
int grabarDirectorio(char* nombreDirectorio, int indiceDirectorio, int padreDirectorio) {
strcpy(arrayDirectorios[indiceDirectorio].nombre, nombreDirectorio);
arrayDirectorios[indiceDirectori... |
C | #include<stdio.h>
#include<string.h>
#include <stdlib.h>
#include <math.h>
int index_first_even (int str[], int num )
{
int index1;
int i;
for (i=0; i<num; i++)
{
if (str[i]%2==0 && str[i]!=0)
{
index1=i;
break;
} }
}
return index1;
}
int index_last_odd(int str[],in... |
C | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: main.c
* Author:
*
* Created on March 10, 2021, 11:41 PM
*/
#include <stdio.h>
#include <stdlib.h>
... |
C | #include "FindVariable.h"
String FindVar(String data, int* index){
String VarName = New_String(strlen(data));
int i = 0;
while ( *(data+*index) != ' ' && *(data+*index) != '+' && *(data+*index) != '\0')
{
*(VarName+i) = *(data+*index);
*index += 1;
i++;
}
variable... |
C | #include "usart.h"
#include "nvic.h"
usart_t *usart1 = (usart_t *)(UART1_BASE);
usart_t *usart2 = (usart_t *)(UART2_BASE);
usart_t *usart3 = (usart_t *)(UART3_BASE);
static usart_t *USART_Get(uint8_t usart) {
switch(usart) {
case USART1: return usart1;
case USART2: return usart2;
case USAR... |
C | #include<stdio.h>
int main(){
int cell;
int sign[6][4];
int j,i;
int row, column;
// int row=3,column=5;
printf("Enter 1 or 0\n");
for(row=1;row<6;row++){
for(column=1;column<4;column++){
printf("cell[%d][%d]=",row,column);
scanf("%d",&cell);
... |
C | /* -*-*-*-*-*-*-*-*-*-*-*-*-*-*
* Amiga_Serial_Read_Async.c
* by Marek Hac on 20/04/2023
* https://github.com/marekhac
* -*-*-*-*-*-*-*-*-*-*-*-*-*-*
* Example of async reading of data from serial port on Amiga.
* Read data in the loop, until CTRL-D is pressed
*
* based on complex tricky example of serial.devic... |
C | /* ------------------------- TEST PHASE ---------------------------- */
t_list *ft_lstnew(void *content)
{
t_list *new;
if (!(new = (t_list *)malloc(sizeof(*content))))
return (NULL);
new->content = content;
new->next = NULL;
return (new);
}
void put_list(t_list *list)
{
if (list == NULL)
return ;... |
C | #include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <stdlib.h>
#define NUMBER_OF_SAMPLES 1024
#define TAU_RANGE 45 // Oblicz korelację tylko dla zakresu od -45 do +45 próbek przesunięcia
#define POWTORZENIA_PETLI 100
#include <math.h>
#define distance_so... |
C | #ifndef __FUNC_H
#define __FUNC_H
#include "types.h"
//------ LIST FUNCTIONS---------//
grayImage *readPGM(char *fname); //Q1 - function gets a name of a text file and returns a grayimage file
Segment findSingleSegment(grayImage *img, imgPos start, unsigned char threshold); //Q2 - the function gets a grayimg, posit... |
C | /** @file led2.c
@author M.P. Hayes
@date 5 Oct 2010
*/
#include "system.h"
#include "navswitch.h"
#include "led.h"
#include "pacer.h"
/* Define polling rate in Hz. (Note, this is much faster than
needed for this application.) */
#define LOOP_RATE 1000
#define LED_RATE_INC 2
#define LED_RATE_MIN 0
#d... |
C | /**
* @file Addition with even numbers
* @author Victor Saul Garcia Godoy Victor Saul (2183042802)
* @brief
* @version 0.1
* @date 2021-10-13
* This program adds the values from a vector if the next value from a position it's a even number.
* @copyright Copyright (c) 2021
*
*
* **/
int array[10... |
C | #include<stdio.h>
int check_anagram(char a[],char b[])
{
int i;
int Hash[26]={0};
for(i=0;a[i]!='\0';i++)
{
Hash[a[i]-97]++;
}
for(i=0;b[i]!='\0';i++)
{
Hash[b[i]-97]--;
if(Hash[b[i]-97]<0)
{
return -1;
}
}
return 0;
}
int main(... |
C | /*
* Create NUM_THREADS threads which print "1" and sleep in pause().
* Then create another thread which prints "2", and re-execs the program.
* The leader then either sleeps in pause(), or exits if $LEADER_EXIT is set.
* This triggers "execve'ed thread replaces thread leader" case.
*
* gcc -Wall -Os -o threaded_... |
C |
#ifndef _DBLLISTS_H
#define _DBLLISTS_H
#define DBL_LIST_HEAD_INIT(name) { &(name), &(name) }
#define DBL_LIST_HEAD(name) struct dbl_list_head name = DBL_LIST_HEAD_INIT(name)
#define DBL_LIST_HEAD_STRUCT(name) struct dbl_list_head name
#define DBL_LIST_TYPE_PTR (struct dbl_list_head *)
#define... |
C | #include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/signal.h>
#include <sys/types.h>
#define _POSIX_SOURCE 1 //POSIX compliant source
volatile int stop=0;
static void sigint(int num) {
stop = 1;
}
int ma... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_character.c :+: :+: :+... |
C | /*
** str.c for str in /home/wery_a/rendu/Rush_marvin/Test/v9
**
** Made by adrien wery
** Login <wery_a@epitech.net>
**
** Started on Sun Jan 4 16:46:10 2015 adrien wery
** Last update Tue May 12 14:53:30 2015 Adrien WERY
*/
#include <unistd.h>
void my_putchar(char c)
{
write(1, &c, 1);
}
void my_putstr(char ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoinf.c :+: :+: :+: ... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
//úָʵּ
int add(int a, int b) {
return a + b;
}
int sub(int a, int b) {
return a - b;
}
int mul(int a, int b) {
return a * b;
}
int div(int a, int b) {
return a / b;
}
int main1() {
int x, y;
int input=1;
int ret=0;
int (*p[5])(int, int) = { 0,add,sub,mul,div ... |
C | #include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include "thread.h"
int number_of_cores()
{
static int cores = 0;
if (cores == 0)
cores = sysconf(_SC_NPROCESSORS_ONLN);
return cores;
}
t_thread* create_thread()
{
t_thread *thread = malloc(sizeof(t_thread));
thread->id = 0;
... |
C | /*
* Copyright (C) by Argonne National Laboratory
* See COPYRIGHT in top-level directory
*/
#include "adio.h"
/* The following function selects the name of the file to be used to
store the shared file pointer. The shared-file-pointer file is a
hidden file in the same directory as the real file being acce... |
C | /*
* Submit an off-line print request
* Select the appropriate spooler for
* the specified printer location.
*/
#include <stdio.h>
struct dests {
char *d_name;
char *d_comm;
} dests[] = {
"-lp", "/bin/lpr",
"-vp", "/bin/vpr",
};
#define NDEST (sizeof(dests)/sizeof(dests[0]))
main(argc, argv)
char *argv[];
{... |
C | #include<stdio.h>
#include<string.h>
#define MAX_LONG 200
#define CADENA_PRUEBA "Hola a todos"
/*
scanf(): Es una función que pertenece a stdio, y permite al usuario ingresar caracteres desde el teclado
hasta que presione enter. En terminal aparecera un promt cuando sea el ciclo de esta función que permitira, desde ... |
C | #include <stdio.h>
#include "swapbig.h"
#define DEBUG
main() //begin main
{
float a, b;
int flag;
printf("Enter values for a and b you would like to swap\nThe value of b must be less than the value of a\n");
flag = scanf("%f %f", &a, &b); //receive initial values from user
while(flag != EOF) /... |
C | #include <stdio.h>
#include <string.h>
#include <stdbool.h>
//Owen Kasprick
//Combines totla occurance count data over all years in Google Ngram dataset 2012 file
int main(int argc, char *argv[]) {
FILE *fp;
//int count = 0;
char buff[10000];
FILE *fpout;
char outbuff[10000];
... |
C | void
matmult_mkn(int m, int n, int k, double **A, double **B, double **C) {
for(int i = 0; i < m; i++)
for(int j =0; j<n; j++)
C[i][j] = 0;
for(int i = 0; i < m; i++){
for(int s = 0; s < k; s++){
for(int j = 0; j < n; j++){
C[i][j] += A[i][s] * B[s][j];
}
... |
C |
#ifndef _CPU_H_
#define _CPU_H_
#include <assert.h>
#include <stdint.h>
#define PAGE_PRESENT 0X01 // 存在标志
#define PAGE_WRITE 0X03 // 可写标志
struct descriptor_t{
uint32_t d0;
uint32_t d1;
};
#pragma pack (2)
struct idtptr_t{
uint16_t limit; // 边界
struct descriptor_t *addr; // 基址
};
#pra... |
C | #include <Motors.h>
void initMotors()
{
// set as output and initialize
LEFT_MOTOR_DIR_DDR |= (1 << LEFT_MOTOR_DIR);
LEFT_MOTOR_DIR_PORT |= (1 << LEFT_MOTOR_DIR);
RIGHT_MOTOR_DIR_DDR |= (1 << RIGHT_MOTOR_DIR);
RIGHT_MOTOR_DIR_PORT |= (1 << RIGHT_MOTOR_DIR);
LEFT_MOTOR_PWM_DDR |= (1 << LEFT_MOTOR_PWM);
RIGHT_MO... |
C | #include <stdio.h>
#include <stdlib.h>
#include "P1G145_877546_877485_controllo_programma.h"
#include <limits.h>
/* Codici errore */
#define carattere_non_valido 3
#define file_inesistente 4
#define file_vuoto 6
#define primo_valore_errato 7
#define programma_incompleto 8
/*
Acquisisce il programma contenuto in inpu... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define pi 3.14159
//Proxy mean
float mean(float* num_arr,int num_num){
float sum=0;
int i;
for(i=0;i<num_num;i++){
sum+=num_arr[i];
}
return sum/num_num;
}
//Proxy isint
int isint(char* num_char){
int num_num;
int flag=0;
int ... |
C | #include <stdio.h>
void bucket(int *array, int n){
// 最大値を見つける
int max = array[0];
for(int i = 1;i < n;i++) if(max < array[i]) max = array[i];
// 最小値を見つける
int min = array[0];
for(int i = 1;i < n;i++) if(min > array[i]) min = array[i];
// バケットに入れる
int b[max-min+1];
for(int i = 0;i < max-min+1;i++) b[i] = 0;
... |
C | #include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#define ROWS 5
#define COLUMNS 5
void printResultMatrix();
int nRowsA, nRowsB, nColsA, nColsB;
int myid, numberOfProcs;
int i, j, k;
int offset, workers;
int divideRows, leftOverRows, rows;
MPI_Status status;
double matrixA[ROWS][COLUMNS] = {
{1.0, 2.0,... |
C | #include <stdio.h>
int main() {
char a = 120;
printf("I am trying a number %d here.\n", a);
return 0;
}
|
C |
#include <stdlib.h>
#include <stdio.h>
#include "extmem.h"
#include<time.h>
#define MAX 1000
typedef struct TempArray
{
int c;
int d;
int blk;
}TempArray;
typedef struct index //
{
int a;
int blk;
}index;
//ȫֱ
int bucketR[5],bucketS[5];
int index_countR=0,index_countS=0;
int temp_count=... |
C | //
// Created by Guilherme on 2021/08/28.
//
#ifndef UNTITLED4_INVPALAVRA_H
#define UNTITLED4_INVPALAVRA_H
#endif //UNTITLED4_INVPALAVRA_H
void inverter_palavras(char x[]){
int i = 0;
No *remover, *pilha = NULL;
while(x[i] != '\0'){
if(x[i] != ' ')
pilha = empilhar(pil... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#define NUM 10
struct event {
struct timeval ev_timeout;
};
typedef struct min_heap
{
struct event** p;//0下标是第一个元素
unsigned n, a;//n队列元素的多少,a代表队列空间的大小
} min_heap_t;
struct event_base {
struct min_heap timeheap;
};
void add(struct timeval *tvp)
{
tvp... |
C | //ADD two numbers using pointer
#include<stdio.h>
int main()
{
int a, b, *p, *q, sum, *s;
p = &a;
q = &b;
s = ∑
printf("Enter the value of a & b ::\n");
scanf("%d%d",p,q);
sum = *p + *q;
printf("The sum of the entered numbers = %d\nAddress of sum = %u",*s,s);
return 0;
}
|
C |
typedef struct noeud {
char* value; // Chaine de caractère indiquand le nom de la cellule (ex : star-line)
char* field; // pointeur sur le debut de la chaine de caractere
int size; //taille de la chaine fieldValue
struct noeud* fils; //Pointeur vers le fils (en dessous)
struct noeud* frere; //Pointeur vers... |
C | #include<stdio.h>
#include<stdlib.h>
#include "tree_bbb.h"
/*
-autor: Lucas Dominato.
-codigo da arvore binaria de busca sem uso de recursao.
*/
Tree* make_tree(){
Tree *t1;
//inicia a arvore binaria de busca alocando memoria.
t1 = (Tree *)calloc(1,sizeof(Tree));
if( !t1 ){
printf("erro ao alocar memoria f... |
C | #include "filesys/inode.h"
#include <list.h>
#include <debug.h>
#include <round.h>
#include <string.h>
#include "filesys/filesys.h"
#include "filesys/free-map.h"
#include "threads/malloc.h"
#include "threads/synch.h"
#include "filesys/cache.h"
/* Identifies an inode. */
#define INODE_MAGIC 0x494e4f44
/* Number of poi... |
C | /* 3
编写一个程序,读取整数直到用户输入0。
输入结束后,程序应报告用户输入的偶数(不包括0)个数、这些偶数的平均值、输入的奇数个数及其奇数的平均值。
*/
#include <stdio.h>
int main(int argc, char const *argv[])
{
int ret;
int evenCount = 0;
int evenSum = 0;
int oddCount = 0;
int oddSum = 0;
int num = 0;
ret = scanf("%d", &num);
while(num != 0) {
... |
C | #include <ctype.h>
#include <stdio.h> // 字符函数,专门用来处理字符的函数,ctype.h头文件中包含了这些函数的原型。
int main()
{
char ch;
ch = getchar(); //只处理字符,他从输入队列中返回下一个元素
while (ch != '\n')
{
ch = toupper(ch); // ctype.h 头文件中的函数,将小写字母转换成大写字母
putchar(ch); // 一次只能打印一个字符
ch = getchar();
}
putchar... |
C | /*
** EPITECH PROJECT, 2018
** PSU_lemipc_2017
** File description:
** team source file
*/
#include "struct.h"
lemipc_team_t *get_team_by_id(int team_id, lemipc_team_t *teams)
{
for (int i = 0; i < max_players; i++)
if (teams[i].team_id == team_id &&
teams[i].team_state != LEMIPC_TEAM_UNDEFINED)
return (&(t... |
C | #include <std.h>
inherit OBJECT;
void create(){
::create();
set_name("vial");
set_id(({ "vial" }));
set_short("%^BOLD%^%^WHITE%^A %^RESET%^%^ORANGE%^corked %^BOLD%^%^WHITE%^vial%^RESET%^");
set_obvious_short("%^BOLD%^%^WHITE%^A %^RESET%^%^ORANGE%^corked %^BOLD%^%^WHITE%^vial%^RESET%^");
set_long(
@AVATAR
%^BOLD%... |
C | #include "Hamming.h"
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define PORT 7229
int main(void){
int sockfd, flag, len, i;
int *data, data_bits, parity_bits, total_bits;
struct sockaddr_in server_address, client_address;
char buffer[1024];
soc... |
C | /*
input.c --
DOS input management.
To do:
- Mouse is assigned to player #1 inputs.
*/
#include "osd.h"
/* Check if a key is pressed */
int check_key(int code)
{
static int lastbuf[0x100] = {0};
if(!key[code] && lastbuf[code] == 1)
lastbuf[code] = 0;
if(key[cod... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
float s1,s2,s3,ort;
printf("birinci sayi giriniz: ");
scanf("%f",&s1);
printf("\n");
printf("ikinci sayiyi giriniz:");
scanf("%f",&s2);
printf("\n");
printf("ucuncu sayiyi giriniz:");
scanf("%f",&s3);
o... |
C | #include "binary_trees.h"
/**
* binary_tree_nodes - function that measures the nodes of a binary tree
* @tree: pointer to the root node
* Return: number of nodes or 0
*/
size_t binary_tree_leaves(const binary_tree_t *tree)
{
size_t left_size, right_size;
if (!tree)
return (0);
if (!tree->left && !tree->rig... |
C | /*
This is an image with inspiration from picasso.
October 2, 2014
Graphics CS 351
-----------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "graphics.h"
int main(int argc, char *argv[]){
Image *src;
const int rows = 500;
... |
C | /*
write a program in c to make such a pattern like a pyramid with numbers
increased by 1. use nested while loop.
1
2 3
4 5 6
7 8 9 10
*/
#include<stdio.h>
void main(){
int i=1;
int k=1;
while(i<=4){
int j=1;
while(j<=7){
if(i+j<=4 || i+j==6 || j-i>=4 || j-i==2 ||i+j==8){
printf("... |
C | #include "holberton.h"
/**
* _strcmp - compares 2 strings
* @s1: string 1
* @s2: string 2
* Return: difference between 2 strings
*/
int _strcmp(char *s1, char *s2)
{
int a = 0;
while (s1[a] && s2[a] && s1[a] == s2[a])
{
a++;
}
return (s1[a] - s2[a]);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int
main()
{
int fd[2];
pid_t child;
if(pipe(fd) == -1) {
perror("pipe");
exit(1);
}
child = fork();
if(child == (pid_t)(-1)) {
perror("fork");
exit(1);
}
else if(child == (pid_t)0) {
close(1);
close(fd[0]);
... |
C |
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void test_function()
{
int j;
printf("Stack high \t%llu\n", (unsigned long long)&j);
}
int main()
{
/* Array Versus Pointer */
const char* pt2 = "I am a string!.";
const char* pt3 = "I am a string!.";
const char* pt4 = "I am a string!!!!!!."; ... |
C | #include "string.h"
#include "stdio.h"
#include "stdlib.h"
typedef struct hash {
char *key;
char *value;
} hash;
int give_number( void );
void give_null ( void );
//###########################################
int main() {
printf("number %d\n", give_number());
give_null();
return 0;
}
int give_number( ... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | /* 文件:chat_data.c
*
* 作用:客户端中的功能选项模块
*
*/
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<termio.h>
#include"chat_data.h"
#include"friends_managment.h"
#include"groups_managment.h"
int getch(void);
void chat_data(int sock_fd)
{
int ret; //用于处理返... |
C | /**
*
*/
#include <Python.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#define NO_IMPORT_ARRAY
#define PY_ARRAY_UNIQUE_SYMBOL BAYESIAN_CLUSTERING_C_ARRAY_API
#include <numpy/arrayobject.h>
#include <stdbool.h>
/**
* Compute Pairwise Probability Matrix
* @param mat buffer to write result to
* @param hi... |
C | #include <pebble.h>
static void window_load(Window* window);
static void window_unload(Window* window);
#define NUM_STATES 8
#define KEY_UP 0
#define KEY_DOWN 1
#define KEY_RIGHT 2
static unsigned char keys[NUM_STATES];
static int8_t curr_state;
static Window* s_window;
static Layer *s_canvas_la... |
C | /*
* Copyright (C) Narf Industries <info@narfindustries.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, cop... |
C | #include <stdio.h>
#include <string.h>
struct point {
int x;
int y;
char name[80];
} p1, p2;
void printPoint(struct point p) {
printf("%d %d %s\n", p.x, p.y, p.name);
}
int main()
{
printf("Enter first point (x, y, name): ");
scanf("%d%d%s", &p1.x, &p1.y, p1.name);
printf("Enter second p... |
C |
#include <malloc.h>
#include <pthread.h>
#include <semaphore.h>
#include <string.h>
struct job
{
/* Link field for linked list*/
struct job *next;
char job_name[10];
};
/* A listing list of pending jobs */
struct job* job_queue;
void enqueue_job(char* job_name);
/* A mutex protecting job_queue */
pthread_m... |
C | /*
* Author: Solongo Munkhjargal
* CS580
*
* Sieve of Eratosthenes
* _____________________
* https://en.wikipedia.org/wiki/Prime_number_theorem
* Prime number theorem states that there are roughly x / log(x) below x;
* */
#include "math.h"
#include "mpi.h"
#include <stdlib.h>
#include <stdio.h>
#include <unis... |
C | /* NIM/Nama : 13509047/Muhammad Hilman Beyri */
/* Nama file : T-12-13509047-mqueuelistlinear.c */
/* Topik : ADT queue list linear */
/* Tanggal : 22 November 2010 */
/* Deskripsi : ADT queue list linear */
#include "queue.h"
#include "graphic.h"
int main() {
Queue Q1;
int X;
int i;
CreateEmpty(&Q1);
pri... |
C | #include <stdio.h>
// ##############################
// Se citesc două numere întregi de la tastatură. Să se afișeze cel mai mic și cel mai mare dintre ele folosind operatorul condițional.
// ##############################
int main() {
// variable
int num1, num2;
// get num1 and num2 values from use... |
C | #include<stdio.h>
#include<stdlib.h>
int main() {
unsigned long long int f,i;
unsigned long long int a=0, b=1, r;
printf("\t %d\n\t 1\n", a);
for (i = 1; i < 46; i++)
{
r = a + b;
printf("%11u\n", r);
a = b;
b = r;
}
system("pause");
return 0;
} |
C | #include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include "mymemory.h"
// Main function to run the program
int main()
{
printf ( "\nshell> start\n");
initialize(); /* Call the initializer function which initializes the memory and segment table */
// Place 3 pointers in ptr... |
C | #include<iostream>
using namespace std;
int main()
{
char str[100];char *p;
int i;
cout<<"enter any string";
gets(str);
p=str;
for(i=0;*(p+i)!='\0';i++);
cout<<"length is <<i;
}
|
C | /*************************************************************************
> File Name: 11.heap_protice5.c
> Author: zhouyuan
> Mail: 3294207721@qq.com
> Created Time: 2021年01月07日 星期四 20时58分44秒
************************************************************************/
#include<stdio.h>
#include<stdlib.h>
#include... |
C | #include <stdio.h>
#include <string.h>
int bin2source(char *inputfile, char *outputfile, char *tablename, int amiga);
const char *HELP = "bin2source 1.1.0\n\
Creates a C bytes array from a file.\n\n\
USAGE:\n\
bin2source inputfile outputfile arrayname [--amiga]\n\
\n\
EXAMPLE:\n\
bin2source test test.c TESTAR... |
C | /*
Student name : Manish Sibanjar
Subject : programming fundamental
Roll no : 21
Lab sheet no : 20
Program : WAP to find the cube of any number using function
Date : 18 jan,2017
*/
#include<stdio.h>
void cube();
int main (){
int n;
printf("Enter any number\n");
scanf("%d",&n);
cube(n);
return 0;
}
void cube(int ... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
};
struct node *head1=0,*head2=0;
struct node *createList()
{
int val;
struct node *temp,*head=0;
printf("Enter numbers consecutively ends with -1: ");
while(1)
{
scanf("%d",&val);
if(val==-1)
return head;
struct node *... |
C | #include <stdio.h>
int main(int argc, const char * argv[]) {
int sum, number,aux, result;
result=0;
for(number=1;sum<1000;number++){
aux=number-1;
while(aux>0 && number%aux!=0)aux--;
if(aux==1){
result+=number;
sum++;
}
}
printf("%d\n",result);
return 0;
}
|
C | /*
** regex.c for regex in /tmp/CACA/raytracer-2017-simon_o/rt/sources/xml
**
** Made by efilon
** Login <efilon@Heisenbergs-RV>
**
** Started on Sat Jun 8 19:30:56 2013 efilon
** Last update Sat Jun 8 19:31:14 2013 efilon
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#inc... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int check_palindrome(char arr[],int start,int end);
int main()
{
char s[100];
gets(s);
char palindromes[strlen(s)][2];
int start_pos=0,end_pos=0;
int palindromes_start=0;
while(end_pos<=strlen(s))
{
if(s[end_pos]=='... |
C | #include<stdio.h>
int main() {
int x, y;
char op;
printf(" ԷϽÿ(: 2 + 5): ");
scanf("%d %c %d", &x, &op, &y);
printf(" \n");
switch (op)
{
case '+':
printf("%d %c %d = %d", x, op, y, x + y);
break;
case '-':
printf("%d %c %d = %d", x, op, y, x - y);
break;
case '*':
printf("%d %c %d = %d", x, op, y, ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
1) binary search tree는 배열이 아니기때문에 구조체별 포인터변수(Tree)만 있어도 가능? tree는 array/list 두 가지로 나타낼 수 있다.
구조체 타입 포인터란? 구조체를 가리키는 포인터
*/
typedef struct node * Tree; //구조체의 포인터 변수(Tree) 선언
typedef struct node * Node;
typedef int element;
struct no... |
C | /* tensor - A memory-efficient data structure for handling numeric data
* The tensor stores the multi-dimensional arrays in row-major order, it means
* consecutive elements of the rows of the array are contiguous in memory.
*
* Accessing array elements that are contiguous in memory are faster than
* accessing elem... |
C | #include <stdio.h>
#include <unistd.h>
#include "../Adafruit_ADS1015.h"
void printBits(size_t const size, void const * const ptr);
Adafruit_ADS1115 ads;
int main(int argc, char *argv[])
{
uint16_t adc0;
ads.setGain(GAIN_EIGHT);
ads.begin();
while (true) {
adc0 = ads.readADC_SingleEnded(0);
printBit... |
C | #include "gif_button_bsp.h"
#include "string.h"
#include "stdio.h"
#include "main.h"
#include "lis2dh12_reg.h"
#include "fatfs_platform.h"
/*
* ST7789 interface
*/
extern SPI_HandleTypeDef hspi1;
/**
* @brief Writes command to select the LCD register.
* @param LCDReg: Address of the selected register.
*/
vo... |
C |
#include<stdio.h>
void main() {
int n;
printf("Enter Number :");
scanf("%d",&n);
for(int i = 1; i <= 10; i++) {
printf("%d * %d =%d\n",n,i, n * i);
}
}
|
C | /*
Ivan Chowdhury
ECE 357: Computer Operating Systems
Fall 2018
Semaphore Operation Implementation [Header]
*/
#include <unistd.h>
#include <sys/types.h>
#define N_PROC 64 // Max number of virtual processors
struct sem
{
char lock; // Mutex locking
int count; // Semaphore counter
pid_t wpid[N_PROC... |
C | #define _CRT_SECURE_NO_WARNINGS 1
//题目:
//给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度。
//不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。
//示例 1 :
//给定数组 nums = [1, 1, 2],
//函数应该返回新的长度 2, 并且原数组 nums 的前两个元素被修改为 1, 2。
//你不需要考虑数组中超出新长度后面的元素。
#include<stdio.h>
int removeDuplicates(int* nums, int numsSize)
{
int i = 0;
... |
C | #include <stdio.h>
/*
噢噢噢噢,终于把这道题凹过去了
分享一下这道题的经验:
这里定义了3个函数分别为:paixu(排序)、bujige(不及格)、zuizhi(最值)
分别对应了三行的输出
具体看函数内的注解
更新了zuizhi的判断
*/
int zuizhi(int a[20],int i)//判断最值
{
int max=a[0],min=a[0];//预先给最值赋值为0
for (int j = 0; j < i; j++)
{
if (a[j+1]>max)//当后数大于前数是给最值赋值为后数
{
/* code *... |
C | //#define _CRT_SECURE_NO_WARNINGS
//int main()
//{
// int arr[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };//һ
// int key = 0;//Ҫҵ
// scanf_s("%d", &key);
// int left = 0;//±
// int right = sizeof(arr) / sizeof(arr[0]) - 1;//±
// while (left <= right)//ʱѭ
// {
// int mid = (left + right) / 2;//м±
// if (arr[mid] < key)//k... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.